Restructuring of the easy-setup service.
authorJay Sharma <jay.sharma@samsung.com>
Fri, 12 Feb 2016 15:43:01 +0000 (21:13 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 15 Feb 2016 08:37:37 +0000 (08:37 +0000)
    - Separated the mediator and enrollee SDKs.
- Created seperate sconscript for the Enrollee and mediator.
- created seperate sconscript for c and c++ sdk [Mediator].
- Created seperate scocscript for Sample apps [mediator & enrollee].

Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Change-Id: If9638544a63cb9906b3973753fcad1721b74f011
Reviewed-on: https://gerrit.iotivity.org/gerrit/4993
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
151 files changed:
build_common/SConscript
service/easy-setup/Build_Instructions_Android_Arduino.txt
service/easy-setup/SConscript
service/easy-setup/enrollee/SConscript [new file with mode: 0644]
service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp [moved from service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.cpp with 100% similarity, mode: 0644]
service/easy-setup/enrollee/arduino/wifi/networkhandler.h [moved from service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.h with 100% similarity]
service/easy-setup/enrollee/inc/easysetup.h [moved from service/easy-setup/sdk/enrollee/api/easysetup.h with 100% similarity]
service/easy-setup/enrollee/inc/onboarding.h [moved from service/easy-setup/sdk/enrollee/inc/onboarding.h with 98% similarity]
service/easy-setup/enrollee/inc/resourcehandler.h [moved from service/easy-setup/sdk/enrollee/inc/resourcehandler.h with 94% similarity]
service/easy-setup/enrollee/inc/softap.h [moved from service/easy-setup/sdk/enrollee/inc/softap.h with 100% similarity]
service/easy-setup/enrollee/linux/wifi/networkhandler.cpp [new file with mode: 0644]
service/easy-setup/enrollee/linux/wifi/networkhandler.h [moved from service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.h with 100% similarity]
service/easy-setup/enrollee/linux/wifi/softapnative.cpp [moved from service/easy-setup/sdk/enrollee/tizen/wifi/softapnative.cpp with 100% similarity]
service/easy-setup/enrollee/linux/wifi/softapnative.h [moved from service/easy-setup/sdk/enrollee/tizen/wifi/softapnative.h with 100% similarity]
service/easy-setup/enrollee/src/easysetup.cpp [moved from service/easy-setup/sdk/enrollee/src/easysetup.cpp with 92% similarity]
service/easy-setup/enrollee/src/onboarding.cpp [moved from service/easy-setup/sdk/enrollee/src/onboarding.cpp with 99% similarity]
service/easy-setup/enrollee/src/resourcehandler.cpp [moved from service/easy-setup/sdk/enrollee/src/resourcehandler.cpp with 87% similarity, mode: 0644]
service/easy-setup/enrollee/src/softap.cpp [moved from service/easy-setup/sdk/enrollee/src/softap.cpp with 99% similarity]
service/easy-setup/enrollee/tizen/wifi/networkhandler.cpp [moved from service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp with 100% similarity]
service/easy-setup/enrollee/tizen/wifi/networkhandler.h [new file with mode: 0644]
service/easy-setup/enrollee/tizen/wifi/softapnative.cpp [moved from service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/Utility.java with 55% similarity, mode: 0644]
service/easy-setup/enrollee/tizen/wifi/softapnative.h [new file with mode: 0644]
service/easy-setup/inc/escommon.h [moved from service/easy-setup/sdk/common/escommon.h with 64% similarity, mode: 0644]
service/easy-setup/mediator/SConscript [moved from service/easy-setup/sampleapp/SConscript with 63% similarity]
service/easy-setup/mediator/csdk/SConscript [new file with mode: 0644]
service/easy-setup/mediator/csdk/inc/prov_adapter.h [moved from service/easy-setup/sdk/mediator/src/prov_adapter.h with 100% similarity]
service/easy-setup/mediator/csdk/inc/provisioning.h [moved from service/easy-setup/sdk/mediator/src/provisioning.h with 100% similarity]
service/easy-setup/mediator/csdk/src/prov_adapter.cpp [moved from service/easy-setup/sdk/mediator/src/prov_adapter.cpp with 92% similarity]
service/easy-setup/mediator/csdk/src/provisioning.cpp [moved from service/easy-setup/sdk/mediator/src/provisioning.cpp with 81% similarity]
service/easy-setup/mediator/csdk/src/wifi_provisioning.cpp [moved from service/easy-setup/sdk/mediator/src/wifi_provisioning.cpp with 90% similarity]
service/easy-setup/mediator/richsdk/SConscript [new file with mode: 0644]
service/easy-setup/mediator/richsdk/android/EasySetupCore/build.gradle [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/build.gradle with 99% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/androidTest.iml [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/androidTest.iml with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceConfigTest.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceConfigTest.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceTest.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceTest.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupStatusTest.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupStatusTest.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactoryTest.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactoryTest.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/Utility.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/Utility.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/AndroidManifest.xml [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/AndroidManifest.xml with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeInfo.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeInfo.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeOnBoardingInfo.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeOnBoardingInfo.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IOnBoardingStatus.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IOnBoardingStatus.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ip/WiFiSoftAPManager.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ip/WiFiSoftAPManager.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESException.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESException.java with 94% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupService.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupService.java with 99% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupStatus.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupStatus.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDevice.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDevice.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactory.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactory.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceWiFiOnboarding.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceWiFiOnboarding.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeSetupError.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeSetupError.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeState.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeState.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IProvisionStatusNativeHandler.java [moved from service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingCallback.java with 80% similarity, mode: 0644]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IpOnBoardingConnection.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IpOnBoardingConnection.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingCallback.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingCallback.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConfig.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConfig.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConnection.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConnection.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningCallback.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningCallback.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningConfig.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningConfig.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/RemoteEnrollee.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/RemoteEnrollee.java with 93% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiOnBoardingConfig.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiOnBoardingConfig.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiProvConfig.java [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiProvConfig.java with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/main.iml [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/main.iml with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/res/values/strings.xml [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/res/values/strings.xml with 100% similarity]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/res/values/styles.xml [moved from service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/res/values/styles.xml with 100% similarity]
service/easy-setup/mediator/richsdk/android/jni/Android.mk [moved from service/easy-setup/sdk/mediator/android/jni/Android.mk with 58% similarity]
service/easy-setup/mediator/richsdk/android/jni/Application.mk [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/Application.mk with 100% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniEasySetup.cpp [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniEasySetup.cpp with 98% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniEasySetup.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniEasySetup.h with 95% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniEsListenerManager.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniEsListenerManager.h with 98% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniEsUtils.cpp [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniEsUtils.cpp with 96% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniEsUtils.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniEsUtils.h with 94% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniJvm.cpp [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniJvm.cpp with 97% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniJvm.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniJvm.h with 98% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniProvisioningStatusLisener.cpp [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniProvisioningStatusLisener.cpp with 98% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniProvisioningStatusListener.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniProvisioningStatusListener.h with 96% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniRemoteEnrollee.cpp [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniRemoteEnrollee.cpp with 98% similarity]
service/easy-setup/mediator/richsdk/android/jni/JniRemoteEnrollee.h [moved from service/easy-setup/sdk/mediator/android/richsdk/jni/JniRemoteEnrollee.h with 97% similarity]
service/easy-setup/mediator/richsdk/inc/ESException.h [moved from service/easy-setup/sdk/mediator/include/ESException.h with 100% similarity]
service/easy-setup/mediator/richsdk/inc/EasySetup.h [moved from service/easy-setup/sdk/mediator/include/EasySetup.h with 97% similarity]
service/easy-setup/mediator/richsdk/inc/EnrolleeSecurity.h [moved from service/easy-setup/sdk/mediator/src/EnrolleeSecurity.h with 86% similarity]
service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h [moved from service/easy-setup/sdk/mediator/include/RemoteEnrollee.h with 97% similarity, mode: 0644]
service/easy-setup/mediator/richsdk/inc/RemoteEnrolleeResource.h [moved from service/easy-setup/sdk/mediator/src/RemoteEnrolleeResource.h with 97% similarity]
service/easy-setup/mediator/richsdk/inc/Utility.h [new file with mode: 0644]
service/easy-setup/mediator/richsdk/src/ESException.cpp [moved from service/easy-setup/sdk/mediator/src/ESException.cpp with 100% similarity]
service/easy-setup/mediator/richsdk/src/EasySetup.cpp [moved from service/easy-setup/sdk/mediator/src/EasySetup.cpp with 96% similarity]
service/easy-setup/mediator/richsdk/src/EnrolleeSecurity.cpp [moved from service/easy-setup/sdk/mediator/src/EnrolleeSecurity.cpp with 54% similarity]
service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp [moved from service/easy-setup/sdk/mediator/src/RemoteEnrollee.cpp with 97% similarity]
service/easy-setup/mediator/richsdk/src/RemoteEnrolleeResource.cpp [moved from service/easy-setup/sdk/mediator/src/RemoteEnrolleeResource.cpp with 97% similarity]
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp
service/easy-setup/sampleapp/enrollee/linux/SConscript [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.cpp [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt
service/easy-setup/sampleapp/mediator/linux/csdk_sample/SConscript [new file with mode: 0644]
service/easy-setup/sampleapp/mediator/linux/csdk_sample/mediator.cpp [moved from service/easy-setup/sampleapp/mediator/linux/mediator.cpp with 100% similarity]
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/SConscript [moved from service/easy-setup/sampleapp/mediator/linux/SConscript with 80% similarity, mode: 0644]
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator_cpp.cpp [moved from service/easy-setup/sampleapp/mediator/linux/mediator_cpp.cpp with 99% similarity, mode: 0644]
service/easy-setup/sdk/mediator/android/.gitignore [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/build.gradle [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/androidTest.iml [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceConfigTest.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceTest.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupStatusTest.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactoryTest.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/AndroidManifest.xml [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupCallbackHandler.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupManager.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeInfo.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeOnBoardingInfo.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IOnBoardingStatus.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IProvisioningListener.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ProvisionEnrollee.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ip/WiFiSoftAPManager.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupService.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupStatus.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDevice.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactory.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceWiFiOnboarding.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeSetupError.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeState.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IpOnBoardingConnection.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConfig.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConnection.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningCallback.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningConfig.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiOnBoardingConfig.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiProvConfig.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/main.iml [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/strings.xml [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/styles.xml [deleted file]
service/easy-setup/sdk/mediator/android/jni/Application.mk [deleted file]
service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp [deleted file]
service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp [deleted file]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp [deleted file]
service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IProvisionStatusNativeHandler.java [deleted file]
service/easy-setup/sdk/mediator/android/richsdk/jni/Android.mk [deleted file]
tools/tizen/iotivity.spec

index f7c2854..67cb756 100644 (file)
@@ -104,7 +104,12 @@ help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device (For Ard
 help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
 help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
 help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
-help_vars.Add(EnumVariable('TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
+#ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
+help_vars.Add(EnumVariable('ES_TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
+#ES_ROLE is for specifying the role (Enrollee or Mediator) for which scons is being executed
+help_vars.Add(EnumVariable('ES_ROLE', 'Target build mode', 'mediator', allowed_values=('mediator', 'enrollee')))
+#ES_SOFT_MODE is for specifying MODE (Mode 1 : Enrollee with  Soft AP or Mode 2  : Mediator with Soft AP)
+help_vars.Add(EnumVariable('ES_SOFTAP_MODE', 'Target build mode', 'ENROLLEE_SOFTAP', allowed_values=('ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP')))
 
 AddOption('--prefix',
                   dest='prefix',
index 3f761ef..b54f354 100644 (file)
@@ -1,6 +1,6 @@
 #******************************************************************
 #
-# Copyright 2015 Samsung Electronics All Rights Reserved.
+# Copyright 2016 Samsung Electronics All Rights Reserved.
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
@@ -43,19 +43,20 @@ Steps to build and deploy Easysetup Mediator in Android platform
         export ANDROID_NDK=<ANDROID_NDK>
 
     a) In the IoTivity root source folder execute
-         scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
+         scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP ES_ROLE=mediator ES_TARGET_ENROLLEE={Platform} RELEASE=0
+                Note : {Platform} can be -> arduino , linux, tizen
 
     b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
         You should see the .aar files generated inside of '<iotivity>/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
 
     c) Now navigate to the Easysetup NDK folder
-        <iotivity-root>/service/easy-setup/sdk/mediator/android
+        <iotivity-root>/service/easy-setup/mediator/richsdk/android
 
     d) Execute NDK-Build with the following command to cross compiled Easysetup JNI .so files
        <iotivity>/extlibs/android/ndk/android-ndk-r10d/ndk-build
 
     e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
-       <iotivity>/service/easy-setup/sdk/mediator/android/libs/armeabi
+       <iotivity>/service/easy-setup/mediator/richsdk/android/libs/armeabi
 
 2) Compilation using Android Studio
 
@@ -63,8 +64,8 @@ Steps to build and deploy Easysetup Mediator in Android platform
         Install Android Studio and use the Android SDK manager to update the Android API to 21
 
     a) Import following projects to the Studio using the "File->New->Import Project"
-        - service\easy-setup\sdk\android\EasySetupCore
-        - service\easy-setup\sampleapp\android\EasySetup
+        - service/easy-setup/mediator/richsdk/android/EasySetupCore
+        - service/easy-setup/sampleapp/android/EasySetup
 
     b) EasySetupCore is dependent on the .aar files generated in 1.b
         1) To add an .aar file to the 'EasySetupCore' project,
@@ -76,11 +77,12 @@ Steps to build and deploy Easysetup Mediator in Android platform
     c)    Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
         If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
             You should see the .aar file generated inside of
-            'iotivity\service\easy-setup\sdk\mediator\android\easySetupCore\build\outputs\aar'
+            'iotivity/service/easy-setup/mediator/richsdk/android/easySetupCore/build/outputs/aar'
 
     d) EasySetup application is also dependent on the .so files generated in 1.d step
-        1) Drag and drop the following .so files in to the EasySetup\app\src\main\jniLibs\armeabi folder
-            - libeasysetup-jni.so [Easy Setup file]
+        1) Drag and drop the following .so files in to the EasySetup/app/src/main/jniLibs/armeabi folder
+            - libeasysetup-jni.so [Easy Setup JNI library]
+                       - libESMediatorRich.so [Easy Setup Mediator library]
 
     e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
         1) To add an .aar file to the 'EasySetup' project,
@@ -111,11 +113,11 @@ Steps to build and deploy Easysetup Mediator in Arduino platform
         NOTE: 1) BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
               2) For Mega board, please use the following options. BOARD=mega & TARGET_ARCH=avr
 
-       Possible values for <transport> are:
+       Possible values for <transport> are: [Only ip is currently supported]
         -> IP :
-        $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
+        $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI ES_ROLE=enrollee RELEASE=0
         -> BLE :
-        $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0
+        $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 [Currently not supporting]
 
         Note :- Only single transport can be built at a time for Arduino
     f) The above command will build sample. The "enrollee.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/enrollee/arduino"
@@ -132,22 +134,38 @@ Steps to build and deploy Easysetup Mediator in Arduino platform
 
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Folder structure:
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 iotivity/
 â””── service
     â””── easy-setup/
         â”‚── SConscript
-        â”‚── sdk
+        â”‚── enrollee
         â”‚    â””── inc
         â”‚    â””── src
-        â”‚    â””── android
-        â”‚    â””── arduino
-        â”‚        â””──wifi
-        â”‚            â””──inc
-        â”‚            â””──src
+        â”‚    â””── arduino/wifi
+        â”‚    â””── linux/wifi
+        â”‚    â””── tizen/wifi
+        â”‚    â””── SConscript
+        â”‚
+        â”‚── mediator
+        â”‚    â””── csdk
+        â”‚        â””──inc
+        â”‚        â””──src
+        â”‚        â””──SConscript
+        â”‚    â””── richsdk
+        â”‚        â””──android
+        â”‚        â””──inc
+        â”‚        â””──src
+        â”‚        â””──SConscript
+        â”‚    â””── SConscript
+        â”‚
         â”‚── sampleapp
         â”‚    â””──mediator/android
         â”‚    â””──mediator/linux
         â”‚    â””──enrollee/arduino
+        â”‚    â””──enrollee/linux
+        â”‚    â””──enrollee/tizen
+        â”‚    â””──enrollee/tizen-sdb
+        â”‚
         â””── Build_Instructions_Android_Arduino.txt - You are reading this.
index e4948e0..fa54745 100755 (executable)
@@ -1,6 +1,6 @@
 #******************************************************************
 #
-# Copyright 2015 Samsung Electronics All Rights Reserved.
+# Copyright 2016 Samsung Electronics All Rights Reserved.
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 ######################################################################
 # easy-setup project build script
 ######################################################################
-import os.path
 Import('env')
 
-easysetup_path = os.curdir
+es_target = env.get ('TARGET_OS')
+es_role = env.get('ES_ROLE')
+es_target_enrollee = env.get('ES_TARGET_ENROLLEE')
 
-######################################################################
-#building Resource client, resourceBroker and resourceCache
-######################################################################
-if env.get('RELEASE'):
-    env.AppendUnique(CCFLAGS = ['-Os'])
-    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
-else:
-    env.AppendUnique(CCFLAGS = ['-g'])
-
-if env.get('LOGGING'):
-    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
-
-# Easysetup provides reference implemenation of Arduino Enrollee.
-# Mediator applications developed on different platforms will be default defining the
-# flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
-# modifications must be enabled instead (and the existing define must be commented).
-#
-##### The following lines must be uncommented, if target Enrollee is not Arduino
-target_enrollee = env.get('TARGET_ENROLLEE')
-if target_enrollee == 'arduino':
-       print "REMOTE_ARDUINO_ENROLEE flag is defined."
-       print "The Mediator application will be working only with Arduino Enrollee."
-       env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
-
-# Add third party libraries
-lib_env = env.Clone()
-SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
-
-easy_setup_env = lib_env.Clone()
-target_os = env.get('TARGET_OS')
-
-######################################################################
-# Build flags
-######################################################################
-easy_setup_env.AppendUnique(CPPPATH = ['sdk/inc', 'sdk/src', 'sdk/common'])
-
-if target_os not in ['windows', 'winrt']:
-    easy_setup_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
-
-if target_os == 'linux':
-   easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
-
-if target_os in ['android']:
-       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
-       if not env.get('RELEASE'):
-               easy_setup_env.AppendUnique(LIBS = ['log'])
-
-if target_os == 'linux':
-       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
-       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
-       if env.get('SECURED') == '1':
-               easy_setup_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
-
-if target_os == 'tizen':
-       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-       easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
-       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
-
-if target_os == 'arduino':
-       easy_setup_env.AppendUnique(CPPPATH = [
-                      env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
-                              env.get('SRC_DIR') + '/resource/oc_logger/include',
-                              env.get('SRC_DIR') + '/resource/csdk/logger/include',
-                              env.get('SRC_DIR') + '/resource/csdk/stack/include',
-                              env.get('SRC_DIR') + '/extlibs/cjson',
-                              'sdk/enrollee/arduino/wifi',
-                              'sdk/enrollee/api',
-                              'sdk/enrollee/src',
-                              'sdk/enrollee/inc'])
-       easy_setup_env.AppendUnique(CPPDEFINES = ['ESWIFI'])
-
-if target_os in ['android','linux']:
-       easy_setup_env.PrependUnique(CPPPATH = [
-               env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
-               env.get('SRC_DIR') + '/resource/include',
-               env.get('SRC_DIR') + '/resource/csdk/logger/include',
-        env.get('SRC_DIR') + '/resource/csdk/stack/include',
-        env.get('SRC_DIR') + '/resource/csdk/logger/include',
-               env.get('SRC_DIR') + '/resource/csdk/security/include',
-               env.get('SRC_DIR') + '/extlibs/cjson',
-               env.get('SRC_DIR') + '/extlibs/sqlite3',
-               '/sdk/common',
-               'sdk/mediator/include',
-               'sdk/mediator/src'])
-       if env.get('SECURED') == '1':
-               easy_setup_env.AppendUnique(CPPPATH = [
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
-                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
-
-if target_os == 'tizen':
-       easy_setup_env.AppendUnique(CPPPATH = [
-                              env.get('SRC_DIR')+'/resource/oc_logger/include',
-                              env.get('SRC_DIR')+'/resource/csdk/logger/include',
-                              env.get('SRC_DIR')+'/resource/csdk/stack/include',
-                              env.get('SRC_DIR')+'/extlibs/cjson',
-                                  'sdk/enrollee/tizen/wifi',
-                                  'sdk/enrollee/api',
-                                  'sdk/enrollee/src',
-                              'sdk/enrollee/inc'])
-       easy_setup_env.AppendUnique(CPPDEFINES = ['ESWIFI'])
-
-######################################################################
-# Source files and Targets
-######################################################################
-
-if target_os == 'arduino':
-       es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
-                                       ['sdk/enrollee/src/easysetup.cpp',
-                                       'sdk/enrollee/src/onboarding.cpp',
-                                       'sdk/enrollee/src/resourcehandler.cpp',
-                                       'sdk/enrollee/arduino/wifi/networkhandler.cpp'])
-       easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK')
-
-if target_os == 'android':
-       es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
-                                       ['sdk/mediator/src/prov_adapter.cpp',
-                                       'sdk/mediator/src/wifi_provisioning.cpp',
-                    'sdk/mediator/src/provisioning.cpp'])
-       easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
-
-if target_os == 'tizen':
-        es_sdk_shared = easy_setup_env.SharedLibrary('ESSDKLibrary',
-                                        ['sdk/enrollee/src/easysetup.cpp',
-                                        'sdk/enrollee/src/onboarding.cpp',
-                                        'sdk/enrollee/src/softap.cpp',
-                                        'sdk/enrollee/src/resourcehandler.cpp',
-                                        'sdk/enrollee/tizen/wifi/networkhandler.cpp',
-                                        'sdk/enrollee/tizen/wifi/softapnative.cpp'])
-        easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
-
-print"easysetup_path %s" % easysetup_path
-
-es_src = None
-
-if target_os in ['android','linux']:
-       if env.get('SECURED') == '1':
-               env.AppendUnique(es_src = [os.path.join(easysetup_path, 'sdk/mediator/src/EnrolleeSecurity.cpp')])
-
-       es_common_src = ['sdk/mediator/src/RemoteEnrollee.cpp',
-               'sdk/mediator/src/RemoteEnrolleeResource.cpp',
-               'sdk/mediator/src/EasySetup.cpp',
-               'sdk/mediator/src/prov_adapter.cpp',
-               'sdk/mediator/src/ESException.cpp',
-               'sdk/mediator/src/wifi_provisioning.cpp',
-               'sdk/mediator/src/provisioning.cpp']
-
-       env.AppendUnique(es_src = es_common_src)
-
-       es_sdk_shared = easy_setup_env.SharedLibrary('ESSDKLibrary', env.get('es_src'))
-       easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
-
-print "Files path is %s" % env.get('es_src')
+print "************************************************************************************"
+print " Easysetup device role --> %s " % es_role
+print "Target Platform --> %s " % es_target
+print "Target Enrollee platform --> %s " % es_target
+print "************************************************************************************"
 
 #Go to build sample apps
-SConscript('sampleapp/SConscript')
+if ('mediator' in es_role) :
+       print "Building Easysetup mediator SDKs [CSDK & RichSDK]"
+
+       if es_target in ['linux','android']:
+               SConscript('mediator/SConscript')
+       else :
+               print "****************************Mediator supports Linux and Android platform****************************"
 
+if ('enrollee' in es_role) :
+       print "Building Easysetup enrollee SDK"
 
+       if es_target in ['linux', 'arduino']:   #TODO add tizen platform [also add dependencies in iotivity.spec file]
+               SConscript('enrollee/SConscript')
+       else :
+               print "****************************Enrollee supports linux, tizen and arduino platform****************************"
\ No newline at end of file
diff --git a/service/easy-setup/enrollee/SConscript b/service/easy-setup/enrollee/SConscript
new file mode 100644 (file)
index 0000000..a2105de
--- /dev/null
@@ -0,0 +1,149 @@
+#######################################################################
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+######################################################################
+# Easy-setup Enrollee SDK build script
+######################################################################
+Import('env')
+
+enrollee_env = env.Clone()
+
+target_os = enrollee_env.get('TARGET_OS')
+
+if enrollee_env.get('RELEASE'):
+    enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
+    enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+else:
+    enrollee_env.AppendUnique(CCFLAGS = ['-g'])
+
+if enrollee_env.get('LOGGING'):
+    enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+# Enrollees are implemented for IP transport only.
+if 'IP' in enrollee_env.get('TARGET_TRANSPORT'):
+       print "Enrollees are implemented for IP transport only"
+       enrollee_env.AppendUnique(CPPDEFINES = ['ESWIFI'])
+
+######################################################################
+# Build flags
+######################################################################
+enrollee_env.PrependUnique(CPPPATH = [
+               enrollee_env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
+               enrollee_env.get('SRC_DIR') + '/resource/include',
+               enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
+               enrollee_env.get('SRC_DIR') + '/resource/oc_logger/include',
+       enrollee_env.get('SRC_DIR') + '/resource/csdk/stack/include',
+        enrollee_env.get('SRC_DIR') + '/resource/csdk/logger/include',
+               enrollee_env.get('SRC_DIR') + '/resource/csdk/security/include',
+               enrollee_env.get('SRC_DIR') + '/extlibs/cjson',
+               enrollee_env.get('SRC_DIR') + '/extlibs/sqlite3',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/inc',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
+
+if enrollee_env.get('SECURED') == '1':
+       enrollee_env.AppendUnique(CPPPATH = [
+               enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
+               enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
+               enrollee_env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
+
+if target_os not in ['windows', 'winrt']:
+       enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+
+######################################################################
+# Linux Enrollee
+######################################################################
+if target_os == 'linux':
+       enrollee_env.PrependUnique(CPPPATH = [
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi'])
+
+       enrollee_env.AppendUnique(LIBS = ['pthread', 'dl'])
+       enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
+       enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+       if enrollee_env.get('SECURED') == '1':
+               enrollee_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
+
+######################################################################
+# Tizen Enrollee
+######################################################################
+if target_os == 'tizen':
+       enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
+       enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+       enrollee_env.AppendUnique(CPPPATH = [
+                              enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
+
+######################################################################
+# Arduino Enrollee
+######################################################################
+if target_os == 'arduino':
+       enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
+       enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+       enrollee_env.AppendUnique(CPPPATH = [
+                      enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+es_enrollee_src = None
+
+if target_os == 'linux':
+       es_enrollee_common_src =        [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.cpp',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.cpp',
+               enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.cpp']
+
+       enrollee_env.AppendUnique(es_enrollee_src = es_enrollee_common_src)
+
+       enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', enrollee_env.get('es_enrollee_src'))
+       enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
+
+if target_os == 'tizen':
+       enrollee_sdk_shared = enrollee_env.SharedLibrary('ESSDKLibrary',
+               [enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/src/easysetup.cpp',
+         enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/src/onboarding.cpp',
+                enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/src/softap.cpp',
+                enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/src/resourcehandler.cpp',
+                enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp',
+                enrollee_env.get('SRC_DIR') + '/service/easy-setup/sdk/enrollee/tizen/wifi/softapnative.cpp'])
+       enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESSDK')
+
+if target_os == 'arduino':
+       es_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', [
+                                       enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.cpp',
+                                       enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.cpp',
+                                       enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.cpp',
+                                       enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
+       enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK')
+
+#Go to build sample apps
+if target_os == 'arduino':
+       SConscript('../sampleapp/enrollee/arduino/SConscript')
+
+if target_os == 'linux':
+       SConscript('../sampleapp/enrollee/linux/SConscript')
+
+
@@ -36,7 +36,7 @@ bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb);
 /**
  * It will return true on-boarding type is soft AP.
  */
-bool ESSoftapOnboarding(); 
+bool ESSoftapOnboarding();
 
 /**
  * It will return true on-boarding type is BLE.
@@ -53,6 +53,8 @@ typedef struct NETRESOURCE
 } NetResource;
 
 OCStackResult CreateProvisioningResource();
+OCStackResult DeleteProvisioningResource();
+OCStackResult DeleteNetworkResource();
 
 //created only for in case of wifi
 #ifdef ESWIFI
@@ -61,5 +63,6 @@ OCStackResult CreateNetworkResource();
 
 void GetTargetNetworkInfoFromProvResource(char *, char *);
 void RegisterResourceEventCallBack(ResourceEventCallback);
+void UnRegisterResourceEventCallBack(void);
 
 #endif
diff --git a/service/easy-setup/enrollee/linux/wifi/networkhandler.cpp b/service/easy-setup/enrollee/linux/wifi/networkhandler.cpp
new file mode 100644 (file)
index 0000000..1e9884b
--- /dev/null
@@ -0,0 +1,74 @@
+/******************************************************************
+ *
+ * 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 <unistd.h>
+
+#include "logger.h"
+#include "easysetup.h"
+#include "networkhandler.h"
+
+#define LOG_TAG "TIZEN ES"
+
+const char *gSsid = "DLNA_LISMORE1";
+const char *gPass = "dlna@010203";
+char *gIpAddress;
+NetworkEventCallback gNetworkEventCb;
+static void ESActivateWifi();
+
+static void ESActivateWifi()
+{
+
+}
+
+static void start()
+{
+    OC_LOG(INFO, LOG_TAG, "START");
+    ESActivateWifi();
+}
+
+void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback cb)
+{
+    OC_LOG_V(INFO, LOG_TAG, "ConnectToWiFiNetwork %s %s",ssid,pass);
+    gPass = pass;
+    gSsid = ssid;
+    gNetworkEventCb = cb;
+    start();
+}
+
+ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info)
+{
+    if (targetType == CT_ADAPTER_IP)
+    {
+        info->type = CT_ADAPTER_IP;
+        info->ipaddr = gIpAddress;
+        if (strlen(gSsid) <= MAXSSIDLEN)
+        {
+            strcpy(info->ssid, gSsid);
+            return ES_OK;
+        }
+        else
+        {
+            return ES_ERROR;
+        }
+    }
+
+    return ES_ERROR;
+}
+
@@ -77,7 +77,7 @@ void OnboardingCallback(ESResult esResult)
         }
         else
         {
-            OC_LOG_V(DEBUG, ES_ENROLLEE_TAG, 
+            OC_LOG_V(DEBUG, ES_ENROLLEE_TAG,
                         "Onboarding is failed callback result is = %d", esResult);
             gEnrolleeStatusCb(esResult, ES_INIT_STATE);
         }
@@ -170,40 +170,45 @@ ESResult InitEasySetup(OCConnectivityType networkType, const char *ssid,
 
 ESResult TerminateEasySetup()
 {
-    if(OCStop() != OC_STACK_OK)
+    UnRegisterResourceEventCallBack();
+
+    //Delete Prov resource
+    if (DeleteProvisioningResource() != OC_STACK_OK)
     {
-        OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop failed");
+        OC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
         return ES_ERROR;
     }
-    else
+
+    //Delete Prov resource
+#ifdef ESWIFI
+    if (DeleteNetworkResource() != OC_STACK_OK)
     {
-        OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack stop success");
-        return ES_OK;
+        OC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
+        return ES_ERROR;
     }
+#endif
+
+    OC_LOG(ERROR, ES_ENROLLEE_TAG, "TerminateEasySetup success");
+    return ES_OK;
 }
 
 ESResult InitProvisioning()
 {
     OC_LOG(INFO, ES_ENROLLEE_TAG, "InitProvisioning <<IN>>");
 
-   // Initialize the OC Stack in Server mode
-    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, ES_ENROLLEE_TAG, "OCStack init error");
-        return ES_ERROR;
-    }
-
     if (CreateProvisioningResource() != OC_STACK_OK)
     {
         OC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error");
         return ES_ERROR;
     }
 
+#ifdef ESWIFI
     if (CreateNetworkResource() != OC_STACK_OK)
     {
         OC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateNetworkResource error");
         return ES_ERROR;
     }
+#endif
 
     RegisterResourceEventCallBack(ProvisioningCallback);
 
@@ -21,8 +21,8 @@
 /**
  * @file
  *
- * This file will have methods for on-boarding the Enrollee device. 
- * This will contain template methods that has will have core business logic & negotiation algorithm on various on-boarding methods.  
+ * This file will have methods for on-boarding the Enrollee device.
+ * This will contain template methods that has will have core business logic & negotiation algorithm on various on-boarding methods.
  */
 
 #include "easysetup.h"
old mode 100755 (executable)
new mode 100644 (file)
similarity index 87%
rename from service/easy-setup/sdk/enrollee/src/resourcehandler.cpp
rename to service/easy-setup/enrollee/src/resourcehandler.cpp
index 18ac940..905b5ae
@@ -67,6 +67,14 @@ void RegisterResourceEventCallBack(ResourceEventCallback cb)
     gNetworkInfoProvEventCb = cb;
 }
 
+void UnRegisterResourceEventCallBack()
+{
+    if (gNetworkInfoProvEventCb)
+    {
+        gNetworkInfoProvEventCb = NULL;
+    }
+}
+
 void GetTargetNetworkInfoFromProvResource(char *name, char *pass)
 {
     if (name != NULL && pass != NULL)
@@ -90,6 +98,17 @@ OCStackResult CreateProvisioningResource()
     return res;
 }
 
+OCStackResult DeleteProvisioningResource()
+{
+    OCStackResult res = OCDeleteResource(gProvResource.handle);
+    if (res != OC_STACK_OK)
+    {
+        OC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res));
+    }
+
+    return res;
+}
+
 #ifdef ESWIFI
 OCStackResult CreateNetworkResource()
 {
@@ -125,7 +144,20 @@ OCStackResult CreateNetworkResource()
 
     return res;
 }
+
+OCStackResult DeleteNetworkResource()
+{
+    OCStackResult res = OCDeleteResource(gNetResource.handle);
+    if (res != OC_STACK_OK)
+    {
+        OC_LOG_V(INFO, ES_RH_TAG, "Deleting Network resource error with result: %s",
+                                                                            getResult(res));
+    }
+
+    return res;
+}
 #endif
+
 OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest,
                                                 OCRepPayload **payload)
 {
@@ -172,6 +204,23 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
         return ehResult;
     }
 
+    //TODO : ES_PS_PROVISIONING_COMPLETED state indicates that already provisioning is completed.
+    // A new request for provisioning means overriding existing network provisioning information.
+    // Metadata to indicate that it is override is needed. The metadata can be a new attribute
+    // should be added to the /oic/prov resource indicating to override the existing network
+    // information.
+    if (gProvResource.ps == ES_PS_PROVISIONING_COMPLETED)
+    {
+        OC_LOG(DEBUG, ES_RH_TAG, "Provisioning already completed. "
+                "This a request to override the existing the network provisioning information");
+    }
+
+    // PUT request is appropriate for provisioning information to the enrollee.
+    // When an enrollee receives the put request, the entire resource information should
+    // be overwritten.
+    sprintf(gProvResource.tnn, "%s", "");
+    sprintf(gProvResource.tnn, "%s", "");
+
     char* tnn;
     if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_TNN, &tnn))
     {
@@ -179,12 +228,14 @@ OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest,
         OC_LOG(INFO, ES_RH_TAG, "got ssid");
     }
 
+       OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.tnn %s", gProvResource.tnn);
     char* cd;
     if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CD, &cd))
     {
         sprintf(gProvResource.cd, "%s", cd);
         OC_LOG(INFO, ES_RH_TAG, "got password");
     }
+       OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.cd %s", gProvResource.cd);
     gProvResource.ps = 2;
     OC_LOG_V(INFO, ES_RH_TAG, "gProvResource.ps %d", gProvResource.ps);
     g_flag = 1;
similarity index 99%
rename from service/easy-setup/sdk/enrollee/src/softap.cpp
rename to service/easy-setup/enrollee/src/softap.cpp
index dc1fe10..2f428d1 100644 (file)
@@ -48,7 +48,6 @@ bool ESSoftapAtMediator()
     return (ESSoftapHost() == MEDIATOR) ? true : false;
 }
 
-
 /**
  * This API will map result returned from the native to the caller.
  * Callback API's signature needs to be modified under build switch according
diff --git a/service/easy-setup/enrollee/tizen/wifi/networkhandler.h b/service/easy-setup/enrollee/tizen/wifi/networkhandler.h
new file mode 100644 (file)
index 0000000..43c68cd
--- /dev/null
@@ -0,0 +1,62 @@
+//******************************************************************
+//
+// 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 IP network handling functionality for Enrollee device
+ */
+
+#ifndef ES_NETWORK_HANDLER_H_
+#define ES_NETWORK_HANDLER_H_
+
+
+#include <string.h>
+#include "easysetup.h"
+#include "logger.h"
+#include "escommon.h"
+
+#define MAXSSIDLEN 33
+#define MAXNETCREDLEN 20
+#define MAXNUMTYPE 5
+#define MAXADDRLEN 15
+
+/*
+ * Callback function for updating the Network status to the subscribers
+ *
+ * @param esResult ESResult provides the current state of the network connection status
+ */
+typedef void (*NetworkEventCallback)(ESResult esResult);
+
+typedef struct
+{
+    OCConnectivityType type;
+    // for WiFI
+    //IPAddress ipaddr;
+    char *ipaddr;
+    char ssid[MAXSSIDLEN];
+    // for BT, BLE
+    //byte mac[6];
+} NetworkInfo;
+
+void ConnectToWiFiNetwork(const char *ssid, const char *pass, NetworkEventCallback);
+ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info);
+
+#endif
@@ -1,42 +1,38 @@
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-\r
-public class Utility {\r
-\r
-    public static void toNotify(Object toLock) {\r
-        synchronized (toLock) {\r
-            toLock.notify();\r
-        }\r
-    }\r
-\r
-    public static void toWait(Object toLock) {\r
-        synchronized (toLock) {\r
-            try {\r
-                toLock.wait(45000);\r
-            } catch (InterruptedException e) {\r
-                e.printStackTrace();\r
-            }\r
-        }\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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 "softapnative.h"
+
+/**
+ * This API will create the Soft AP at Enrollee device. 
+ */
+void ESCreateSoftapNative(const char * ssid, const char* passwd, SoftAPCallbackNative cb)
+{
+    const char *ip, *macaddr, *devicename;
+
+    // Soft is created successfully. This callback may be send from other cascaded callbacks
+    cb(SOFTAP_SUCCESS, ip, macaddr, devicename);
+
+    // TODO: Use below code to indicate failed on-boarding / softap creation
+    // Soft creation is failed. This callback may be send from other cascaded callbacks 
+    //cb(SOFTAP_FAILED, nullptr,nullptr,nullptr);
+}
+
diff --git a/service/easy-setup/enrollee/tizen/wifi/softapnative.h b/service/easy-setup/enrollee/tizen/wifi/softapnative.h
new file mode 100644 (file)
index 0000000..35c3773
--- /dev/null
@@ -0,0 +1,53 @@
+//******************************************************************
+//
+// 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 API declaration for creating & configuration for SoftAP 
+ */
+
+#ifndef EASYSETUP_ENROLLEE_SOFTAP_H__
+#define EASYSETUP_ENROLLEE_SOFTAP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+
+#define SOFTAP_SUCCESS  1
+#define SOFTAP_FAILED   0
+
+
+//This callback signagure may get changed as per the native implementation.
+typedef void (*SoftAPCallbackNative)(int result, const char *ip, const char* mac_addr,
+                                                                        const char*device_name);
+
+void ESCreateSoftapNative(const char * ssid, const char* passwd, SoftAPCallbackNative cb);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+
+#endif /* EASYSETUP_ENROLLEE_SOFTAP_H__ */
+
+
+
old mode 100755 (executable)
new mode 100644 (file)
similarity index 64%
rename from service/easy-setup/sdk/common/escommon.h
rename to service/easy-setup/inc/escommon.h
index 24963b5..6ee898e
@@ -21,6 +21,7 @@
 #ifndef ES_COMMON_H_
 #define ES_COMMON_H_
 
+#include <iostream>
 #include <string>
 #ifndef WITH_ARDUINO
 #include <memory>
@@ -29,6 +30,8 @@
 #include "ocstack.h"
 #include "octypes.h"
 
+using namespace std;
+
 // Defines
 #define OIC_STRING_MAX_VALUE    100
 #define IPV4_ADDR_SIZE          16
@@ -228,128 +231,4 @@ typedef struct
  */
 typedef void (*OCProvisioningStatusCB)(EasySetupInfo *easySetupInfo);
 
-#ifndef WITH_ARDUINO
-
-namespace OIC
-{
-    namespace Service
-    {
-        typedef enum
-        {
-            ES_PROVISIONING_ERROR = -1,
-            ES_NEED_PROVISIONING,
-            ES_PROVISIONED_ALREADY,
-            ES_PROVISIONING_SUCCESS
-        } ESState;
-
-        typedef enum
-        {
-            ES_UNKNOWN = 0,
-            ES_ONBOARDED,
-            ES_OWNED,
-            ES_PROVISIONED
-        } CurrentESState;
-
-        typedef enum
-        {
-            ES_SEC_UNKNOWN = 0,
-            ES_SEC_OWNED,
-            ES_SEC_ACL_PROVISIONED,
-            ES_SEC_CREDS_PROVISIONED
-        } EnrolleeSecState;
-
-        /**
-         * Security Provisioning Status
-         */
-        class SecProvisioningResult
-        {
-        public:
-            std::shared_ptr< SecProvisioningResult > shared_ptr;
-            SecProvisioningResult(std::string deviceUUID, ESResult result) :
-                m_devUUID(deviceUUID), m_result(result)
-            {
-
-            }
-
-            std::string getDeviceUUID()
-            {
-                return m_devUUID;
-            }
-
-            ESResult getResult()
-            {
-                return m_result;
-            }
-        private:
-            std::string m_devUUID;
-            ESResult m_result;
-        };
-
-        /**
-         * Callback function definition for providing Enrollee security status .
-         */
-        typedef std::function< void(std::shared_ptr<SecProvisioningResult>) > EnrolleeSecStatusCb;
-
-        /**
-         * Callback definition to be invoked when the security stack expects a pin from application.
-         */
-        typedef std::function< void(std::string&) > SecurityPinCb;
-
-        /**
-         * Callback definition to be invoked when the stack expects a db path.
-         */
-        typedef std::function< void(std::string&) > SecProvisioningDbPathCb;
-
-        class ProvisioningStatus
-        {
-        public:
-            std::shared_ptr< ProvisioningStatus > shared_ptr;
-            ProvisioningStatus(ESResult result, ESState esState) :
-                    m_result(result), m_esState(esState)
-            {
-
-            }
-
-            ESResult& getESResult()
-            {
-                return m_result;
-            }
-
-            ESState& getESState()
-            {
-                return m_esState;
-            }
-        private:
-            ESResult m_result;
-            ESState m_esState;
-        };
-
-        class EasySetupStatus
-        {
-        public:
-            std::shared_ptr< EasySetupStatus > shared_ptr;
-            EasySetupStatus(const EasySetupState& easySetupState,
-                    const EnrolleeNWProvInfo& enrolleeNWProvInfo) :
-                    m_easySetupState(easySetupState), m_enrolleeNWProvInfo(enrolleeNWProvInfo)
-            {
-
-            }
-
-            EnrolleeNWProvInfo& getEasySetupNWProvInfo()
-            {
-                return m_enrolleeNWProvInfo;
-            }
-
-            EasySetupState& getEasySetupState()
-            {
-                return m_easySetupState;
-            }
-        private:
-            EasySetupState m_easySetupState;
-            EnrolleeNWProvInfo m_enrolleeNWProvInfo;
-        };
-    }
-}
-#endif //WITH_ARDUINO
-
 #endif //ES_COMMON_H_
similarity index 63%
rename from service/easy-setup/sampleapp/SConscript
rename to service/easy-setup/mediator/SConscript
index db2fcf8..0e35382 100644 (file)
@@ -1,6 +1,6 @@
 #******************************************************************
 #
-# Copyright 2015 Samsung Electronics All Rights Reserved.
+# Copyright 2016 Samsung Electronics All Rights Reserved.
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-##
-# sampleapp build script
-##
-
+######################################################################
+# easy-setup Mediator SDKs build script
+######################################################################
 Import('env')
 
-# Add third party libraries
-lib_env = env.Clone()
-
-sample_env = lib_env.Clone()
 target_os = env.get('TARGET_OS')
 
-######################################################################
-# Build flags
-######################################################################
+# Build easy-setup Mediator C SDK
+SConscript('csdk/SConscript')
+
+# Build easy-setup Mediator Rich [C++] SDK
+SConscript('richsdk/SConscript')
 
-######################################################################
-# Source files and Targets
-######################################################################
-if target_os == 'arduino' :
-       # Build arduino sample app
-       SConscript('enrollee/arduino/SConscript')
 
-if target_os == 'linux' :
-       # Build linux sample app
-       SConscript('mediator/linux/SConscript')
diff --git a/service/easy-setup/mediator/csdk/SConscript b/service/easy-setup/mediator/csdk/SConscript
new file mode 100644 (file)
index 0000000..39ff052
--- /dev/null
@@ -0,0 +1,133 @@
+#******************************************************************
+#
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+######################################################################
+# easy-setup Mediator CSDK build script
+######################################################################
+
+import os
+
+Import('env')
+
+env.AppendUnique(CPPDEFINES = ['EASY_SETUP_CA_INIT'])
+
+if env.get('RELEASE'):
+    env.AppendUnique(CCFLAGS = ['-Os'])
+    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+else:
+    env.AppendUnique(CCFLAGS = ['-g'])
+
+if env.get('LOGGING'):
+    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+# Easysetup provides reference implemenation of Arduino Enrollee.
+# Mediator applications developed on different platforms will be default defining the
+# flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
+# modifications must be enabled instead (and the existing define must be commented).
+#
+##### The following lines must be uncommented, if target Enrollee is not Arduino
+target_enrollee = env.get('ES_TARGET_ENROLLEE')
+if target_enrollee == 'arduino':
+       print "REMOTE_ARDUINO_ENROLEE flag is defined."
+       print "The Mediator application will be working only with Arduino Enrollee."
+       env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
+
+lib_env = env.Clone()
+easy_setup_env = env.Clone()
+
+target_os = env.get('TARGET_OS')
+
+if target_os in ['android']:
+       # Add third party libraries
+       SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+
+######################################################################
+# Build flags
+######################################################################
+
+easy_setup_env.AppendUnique(CPPPATH = ['inc',  'src','../../inc'])
+easy_setup_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
+if target_os == 'linux':
+       easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
+
+       
+######################################################################
+# Linux Mediator
+###################################################################### 
+if target_os == 'linux':
+       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
+       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+       
+######################################################################
+# Android Mediator
+###################################################################### 
+if target_os == 'android':
+       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
+       if not env.get('RELEASE'):
+               easy_setup_env.AppendUnique(LIBS = ['log'])
+
+
+if target_os in ['android','linux']:                                      
+       easy_setup_env.PrependUnique(CPPPATH = [
+               env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',           
+               env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
+               env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
+        env.get('SRC_DIR') + '/resource/csdk/stack/include',
+               env.get('SRC_DIR') + '/resource/csdk/security/include',
+               env.get('SRC_DIR') + '/extlibs/cjson',
+               env.get('SRC_DIR') + '/service/easy-setup/inc',
+               'inc'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+
+if target_os == 'android':
+       es_m_csdk_static = easy_setup_env.StaticLibrary('libESMediatorCSDK',
+                                       ['src/prov_adapter.cpp',
+                                       'src/wifi_provisioning.cpp',
+                    'src/provisioning.cpp'])
+       easy_setup_env.InstallTarget(es_m_csdk_static, 'libESMediatorCSDK')
+
+if target_os == 'linux':
+       es_m_csdk_shared = easy_setup_env.SharedLibrary('ESMediatorCSDK',
+                                       ['src/prov_adapter.cpp',
+                                       'src/wifi_provisioning.cpp',
+                    'src/provisioning.cpp'])
+       easy_setup_env.InstallTarget(es_m_csdk_shared, 'libESMediatorCSDK')
+
+       #Go to build sample apps
+       SConscript('../../sampleapp/mediator/linux/csdk_sample/SConscript')
+
+
+
+
+
+
+
+
+
+
+
@@ -51,10 +51,10 @@ OCStackResult InitProvProcess() {
 
     if (InitProvisioningHandler() == OC_STACK_OK) {
         result = OC_STACK_OK;
-        OC_LOG(DEBUG, ES_PROV_ADAP_TAG, "InitProvisioningHandler returned Success");
+        OIC_LOG(DEBUG, ES_PROV_ADAP_TAG, "InitProvisioningHandler returned Success");
     } else {
         result = OC_STACK_ERROR;
-        OC_LOG_V(ERROR, ES_PROV_ADAP_TAG, "InitProvisioningHandler returned error = %d",
+        OIC_LOG_V(ERROR, ES_PROV_ADAP_TAG, "InitProvisioningHandler returned error = %d",
                   result);
     }
 
@@ -73,7 +73,7 @@ OCStackResult RegisterCallback(OCProvisioningStatusCB provisioningStatusCallback
     }
     else {
         result = OC_STACK_ERROR;
-        OC_LOG(ERROR, ES_PROV_ADAP_TAG, "provisioningStatusCallback is NULL");
+        OIC_LOG(ERROR, ES_PROV_ADAP_TAG, "provisioningStatusCallback is NULL");
     }
 
     return result;
@@ -64,7 +64,7 @@ OCStackResult InitProvisioningHandler() {
     OCStackResult ret = OC_STACK_ERROR;
     /* Initialize OCStack*/
     if (OCInit(NULL, 0, OC_CLIENT) != OC_STACK_OK) {
-        OC_LOG(ERROR, ES_PROV_TAG, "OCStack init error");
+        OIC_LOG(ERROR, ES_PROV_TAG, "OCStack init error");
         return ret;
     }
 
@@ -72,7 +72,7 @@ OCStackResult InitProvisioningHandler() {
     pthread_t thread_handle;
 
     if (pthread_create(&thread_handle, NULL, listeningFunc, NULL)) {
-        OC_LOG(DEBUG, ES_PROV_TAG, "Thread creation failed");
+        OIC_LOG(DEBUG, ES_PROV_TAG, "Thread creation failed");
         return OC_STACK_ERROR;
     }
 
@@ -82,7 +82,7 @@ OCStackResult InitProvisioningHandler() {
 OCStackResult TerminateProvisioningHandler() {
     OCStackResult ret = OC_STACK_ERROR;
     if (OCStop() != OC_STACK_OK) {
-        OC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
+        OIC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
     }
 
     g_provisioningCondFlag = true;
@@ -98,7 +98,7 @@ void *listeningFunc(void* /*data*/) {
         result = OCProcess();
 
         if (result != OC_STACK_OK) {
-            OC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
+            OIC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
         }
 
         // To minimize CPU utilization we may wish to do this with sleep
@@ -110,7 +110,7 @@ void *listeningFunc(void* /*data*/) {
 
 OCStackApplicationResult ProvisionEnrolleeResponse(void* /*ctx*/, OCDoHandle /*handle*/,
                                                    OCClientResponse *clientResponse) {
-    OC_LOG_V(DEBUG, ES_PROV_TAG, "INSIDE ProvisionEnrolleeResponse");
+    OIC_LOG_V(DEBUG, ES_PROV_TAG, "INSIDE ProvisionEnrolleeResponse");
 
     // If user stopped the process then return from this function;
     if (IsSetupStopped()) {
@@ -139,7 +139,7 @@ OCStackApplicationResult ProvisionEnrolleeResponse(void* /*ctx*/, OCDoHandle /*h
                 continue;
             }
             else {
-                OC_LOG_V(DEBUG, ES_PROV_TAG, "PS is NOT proper");
+                OIC_LOG_V(DEBUG, ES_PROV_TAG, "PS is NOT proper");
                 goto Error;
 
             }
@@ -147,24 +147,24 @@ OCStackApplicationResult ProvisionEnrolleeResponse(void* /*ctx*/, OCDoHandle /*h
 
         if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_TNN, &tnn)) {
             if (!strcmp(tnn, netProvInfo->netAddressInfo.WIFI.ssid)) {
-                OC_LOG_V(DEBUG, ES_PROV_TAG, "SSID is proper");
+                OIC_LOG_V(DEBUG, ES_PROV_TAG, "SSID is proper");
                 input = input->next;
                 continue;
             }
             else {
-                OC_LOG_V(DEBUG, ES_PROV_TAG, "SSID is NOT proper");
+                OIC_LOG_V(DEBUG, ES_PROV_TAG, "SSID is NOT proper");
                 goto Error;
             }
         }
 
         if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CD, &cd)) {
             if (!strcmp(cd, netProvInfo->netAddressInfo.WIFI.pwd)) {
-                OC_LOG_V(DEBUG, ES_PROV_TAG, "Password is proper");
+                OIC_LOG_V(DEBUG, ES_PROV_TAG, "Password is proper");
                 input = input->next;
                 continue;
             }
             else {
-                OC_LOG_V(DEBUG, ES_PROV_TAG, "Password is NOT proper");
+                OIC_LOG_V(DEBUG, ES_PROV_TAG, "Password is NOT proper");
                 goto Error;
             }
         }
@@ -203,7 +203,7 @@ OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo *netInfo,
     }
     else
     {
-        OC_LOG(ERROR, ES_PROV_TAG, PCF("Find resource query is NULL"));
+        OIC_LOG(ERROR, ES_PROV_TAG, PCF("Find resource query is NULL"));
         goto Error;
     }
 
@@ -215,7 +215,7 @@ OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo *netInfo,
 
     if (!SetProgress(provisioningStatusCallback)) {
         // Device provisioning session is running already.
-        OC_LOG(INFO, ES_PROV_TAG, PCF("Device provisioning session is running already"));
+        OIC_LOG(INFO, ES_PROV_TAG, PCF("Device provisioning session is running already"));
         goto Error;
     }
 
@@ -249,7 +249,7 @@ void StopProvisioningProcess() {
 
 bool ClearMemory() {
 
-    OC_LOG(DEBUG, ES_PROV_TAG, "thread_pool_add_task of FindProvisioningResource failed");
+    OIC_LOG(DEBUG, ES_PROV_TAG, "thread_pool_add_task of FindProvisioningResource failed");
     OICFree(netProvInfo);
     return true;
 
@@ -261,16 +261,16 @@ bool ConfigEnrolleeObject(const EnrolleeNWProvInfo *netInfo) {
     netProvInfo = (EnrolleeNWProvInfo *) OICCalloc(1, sizeof(EnrolleeNWProvInfo));
 
     if (netProvInfo == NULL) {
-        OC_LOG(ERROR, ES_PROV_TAG, "Invalid input..");
+        OIC_LOG(ERROR, ES_PROV_TAG, "Invalid input..");
         return false;
     }
 
     memcpy(netProvInfo, netInfo, sizeof(EnrolleeNWProvInfo));
 
-    OC_LOG_V(DEBUG, ES_PROV_TAG, "Network Provisioning Info. SSID = %s",
+    OIC_LOG_V(DEBUG, ES_PROV_TAG, "Network Provisioning Info. SSID = %s",
               netProvInfo->netAddressInfo.WIFI.ssid);
 
-    OC_LOG_V(DEBUG, ES_PROV_TAG, "Network Provisioning Info. PWD = %s",
+    OIC_LOG_V(DEBUG, ES_PROV_TAG, "Network Provisioning Info. PWD = %s",
               netProvInfo->netAddressInfo.WIFI.pwd);
 
     return true;
@@ -281,53 +281,53 @@ void LogProvisioningResponse(OCRepPayloadValue * val) {
 
     switch (val->type) {
         case OCREP_PROP_NULL:
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s: NULL", val->name);
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s: NULL", val->name);
             break;
         case OCREP_PROP_INT:
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(int):%lld", val->name, val->i);
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(int):%lld", val->name, val->i);
             break;
         case OCREP_PROP_DOUBLE:
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(double):%f", val->name, val->d);
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(double):%f", val->name, val->d);
             break;
         case OCREP_PROP_BOOL:
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(bool):%s", val->name, val->b ? "true" : "false");
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(bool):%s", val->name, val->b ? "true" : "false");
             break;
         case OCREP_PROP_STRING:
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(string):%s", val->name, val->str);
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(string):%s", val->name, val->str);
             break;
         case OCREP_PROP_OBJECT:
             // Note: Only prints the URI (if available), to print further, you'll
             // need to dig into the object better!
-            OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(OCRep):%s", val->name, val->obj->uri);
+            OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(OCRep):%s", val->name, val->obj->uri);
             break;
         case OCREP_PROP_ARRAY:
             switch (val->arr.type) {
                 case OCREP_PROP_INT:
-                    OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(int array):%zu x %zu x %zu",
+                    OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(int array):%zu x %zu x %zu",
                               val->name,
                               val->arr.dimensions[0], val->arr.dimensions[1],
                               val->arr.dimensions[2]);
                     break;
                 case OCREP_PROP_DOUBLE:
-                    OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(double array):%zu x %zu x %zu",
+                    OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(double array):%zu x %zu x %zu",
                               val->name,
                               val->arr.dimensions[0], val->arr.dimensions[1],
                               val->arr.dimensions[2]);
                     break;
                 case OCREP_PROP_BOOL:
-                    OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(bool array):%zu x %zu x %zu",
+                    OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(bool array):%zu x %zu x %zu",
                               val->name,
                               val->arr.dimensions[0], val->arr.dimensions[1],
                               val->arr.dimensions[2]);
                     break;
                 case OCREP_PROP_STRING:
-                    OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(string array):%zu x %zu x %zu",
+                    OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(string array):%zu x %zu x %zu",
                               val->name,
                               val->arr.dimensions[0], val->arr.dimensions[1],
                               val->arr.dimensions[2]);
                     break;
                 case OCREP_PROP_OBJECT:
-                    OC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(OCRep array):%zu x %zu x %zu",
+                    OIC_LOG_V(DEBUG, ES_PROV_TAG, "\t\t%s(OCRep array):%zu x %zu x %zu",
                               val->name,
                               val->arr.dimensions[0], val->arr.dimensions[1],
                               val->arr.dimensions[2]);
@@ -344,7 +344,7 @@ void LogProvisioningResponse(OCRepPayloadValue * val) {
 OCStackResult FindNetworkResource() {
     OCStackResult ret = OC_STACK_ERROR;
     if (OCStop() != OC_STACK_OK) {
-        OC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
+        OIC_LOG(ERROR, ES_PROV_TAG, "OCStack stop error");
     }
 
     return ret;
@@ -356,14 +356,14 @@ ProvisioningInfo *PrepareProvisioingStatusCB(OCClientResponse *clientResponse,
     ProvisioningInfo *provInfo = (ProvisioningInfo *) OICCalloc(1, sizeof(ProvisioningInfo));
 
     if (provInfo == NULL) {
-        OC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
+        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
         return NULL;
     }
 
     OCDevAddr *devAddr = (OCDevAddr *) OICCalloc(1, sizeof(OCDevAddr));
 
     if (devAddr == NULL) {
-        OC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
+        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
         OICFree(provInfo);
         return NULL;
     }
@@ -384,7 +384,7 @@ bool InProgress() {
 
     // It means already Easy Setup provisioning session is going on.
     if (NULL != cbData) {
-        OC_LOG(ERROR, ES_PROV_TAG, "Easy setup session is already in progress");
+        OIC_LOG(ERROR, ES_PROV_TAG, "Easy setup session is already in progress");
         return true;
     }
 
@@ -413,14 +413,14 @@ ProvisioningInfo *CreateCallBackObject() {
     ProvisioningInfo *provInfo = (ProvisioningInfo *) OICCalloc(1, sizeof(ProvisioningInfo));
 
     if (provInfo == NULL) {
-        OC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
+        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
         return NULL;
     }
 
     OCDevAddr *devAddr = (OCDevAddr *) OICCalloc(1, sizeof(OCDevAddr));
 
     if (devAddr == NULL) {
-        OC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
+        OIC_LOG_V(ERROR, ES_PROV_TAG, "Failed to allocate memory");
         OICFree(provInfo);
         return NULL;
     }
@@ -457,7 +457,7 @@ bool ValidateFinddResourceResponse(OCClientResponse * clientResponse) {
 
     if (!(clientResponse) || !(clientResponse->payload)) {
 
-        OC_LOG_V(INFO, ES_PROV_TAG, "ProvisionEnrolleeResponse received Null clientResponse");
+        OIC_LOG_V(INFO, ES_PROV_TAG, "ProvisionEnrolleeResponse received Null clientResponse");
 
         return false;
 
@@ -469,7 +469,7 @@ bool ValidateEnrolleResponse(OCClientResponse * clientResponse) {
 
     if (!(clientResponse) || !(clientResponse->payload)) {
 
-        OC_LOG_V(INFO, ES_PROV_TAG, "ProvisionEnrolleeResponse received Null clientResponse");
+        OIC_LOG_V(INFO, ES_PROV_TAG, "ProvisionEnrolleeResponse received Null clientResponse");
 
         return false;
 
@@ -477,7 +477,7 @@ bool ValidateEnrolleResponse(OCClientResponse * clientResponse) {
 
     if (clientResponse->payload->type != PAYLOAD_TYPE_REPRESENTATION) {
 
-        OC_LOG_V(DEBUG, ES_PROV_TAG, "Incoming payload not a representation");
+        OIC_LOG_V(DEBUG, ES_PROV_TAG, "Incoming payload not a representation");
         return false;
 
     }
@@ -504,7 +504,7 @@ void* FindProvisioningResource(void* /*data*/) {
 
     OCStackResult ret = OC_STACK_ERROR;
 
-    OC_LOG_V(DEBUG, ES_PROV_TAG, "szFindResourceQueryUri = %s", szFindResourceQueryUri);
+    OIC_LOG_V(DEBUG, ES_PROV_TAG, "szFindResourceQueryUri = %s", szFindResourceQueryUri);
 
     OCCallbackData ocCBData;
 
@@ -540,7 +540,7 @@ OCStackResult InvokeOCDoResource(const char *query, OCMethod method, const OCDev
                        &cbData, options, numOptions);
 
     if (ret != OC_STACK_OK) {
-        OC_LOG_V(ERROR, ES_PROV_TAG, "OCDoResource returns error %d with method %d", ret, method);
+        OIC_LOG_V(ERROR, ES_PROV_TAG, "OCDoResource returns error %d with method %d", ret, method);
     }
 
     return ret;
@@ -551,9 +551,9 @@ OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char *query, const
 
 
     // This sleep is required in case of BLE provisioning due to packet drop issue.
-    OC_LOG_V(INFO, ES_PROV_TAG, "Sleeping for %d seconds", pauseBeforeStart);
+    OIC_LOG_V(INFO, ES_PROV_TAG, "Sleeping for %d seconds", pauseBeforeStart);
     sleep(pauseBeforeStart);
-    OC_LOG_V(INFO, ES_PROV_TAG, "\n\nExecuting ProvisionEnrollee%s", __func__);
+    OIC_LOG_V(INFO, ES_PROV_TAG, "\n\nExecuting ProvisionEnrollee%s", __func__);
 
     OCRepPayload *payload = OCRepPayloadCreate();
 
@@ -561,7 +561,7 @@ OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char *query, const
     OCRepPayloadSetPropString(payload, OC_RSRVD_ES_TNN, netProvInfo->netAddressInfo.WIFI.ssid);
     OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CD, netProvInfo->netAddressInfo.WIFI.pwd);
 
-    OC_LOG_V(DEBUG, ES_PROV_TAG, "OCPayload ready for ProvisionEnrollee");
+    OIC_LOG_V(DEBUG, ES_PROV_TAG, "OCPayload ready for ProvisionEnrollee");
 
     OCStackResult ret = InvokeOCDoResource(query, OC_REST_PUT, destination, qos,
                                            ProvisionEnrolleeResponse, payload, NULL, 0);
@@ -66,7 +66,7 @@ OCStackApplicationResult GetProvisioningStatusResponse(void* /*ctx*/,
     char resURI[MAX_URI_LENGTH] =
             {'\0'};
 
-    OC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", input->uri);
+    OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", input->uri);
 
     strncpy(resURI, input->uri, sizeof(resURI) - 1);
 
@@ -86,7 +86,7 @@ OCStackApplicationResult GetProvisioningStatusResponse(void* /*ctx*/,
 
     if (ProvisionEnrollee(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, clientResponse->addr, 0)
         != OC_STACK_OK) {
-        OC_LOG(INFO, ES_WIFI_PROV_TAG, "GetProvisioningStatusResponse received NULL clientResponse");
+        OIC_LOG(INFO, ES_WIFI_PROV_TAG, "GetProvisioningStatusResponse received NULL clientResponse");
 
         ErrorCallback(DEVICE_NOT_PROVISIONED);
         ClearMemory();
@@ -102,7 +102,7 @@ OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char *query,
     OCStackResult ret = OC_STACK_ERROR;
     OCHeaderOption options[MAX_HEADER_OPTIONS];
 
-    OC_LOG_V(INFO, ES_WIFI_PROV_TAG, "\n\nExecuting %s", __func__);
+    OIC_LOG_V(INFO, ES_WIFI_PROV_TAG, "\n\nExecuting %s", __func__);
 
     uint8_t option0[] =
             {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@@ -129,7 +129,7 @@ OCStackApplicationResult FindProvisioningResourceResponse(void* /*ctx*/,
                                                             OCDoHandle /*handle*/,
                                                             OCClientResponse *clientResponse) {
 
-    OC_LOG_V(INFO, ES_WIFI_PROV_TAG, "Entering FindProvisioningResourceResponse %s",
+    OIC_LOG_V(INFO, ES_WIFI_PROV_TAG, "Entering FindProvisioningResourceResponse %s",
             clientResponse->devAddr.addr);
 
     // If user stopped the process then return from this function;
@@ -148,7 +148,7 @@ OCStackApplicationResult FindProvisioningResourceResponse(void* /*ctx*/,
 
     OCDiscoveryPayload *discoveryPayload = (OCDiscoveryPayload * )(clientResponse->payload);
 
-    OC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", discoveryPayload->resources->uri);
+    OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "resUri = %s", discoveryPayload->resources->uri);
 
 #ifdef REMOTE_ARDUINO_ENROLEE
     //Arduino Enrollee needs mediator application provide IP and port55555 which is specific
@@ -165,7 +165,7 @@ OCStackApplicationResult FindProvisioningResourceResponse(void* /*ctx*/,
              discoveryPayload->resources->uri);
 #endif
 
-    OC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "query before GetProvisioningStatus call = %s", szQueryUri);
+    OIC_LOG_V(DEBUG, ES_WIFI_PROV_TAG, "query before GetProvisioningStatus call = %s", szQueryUri);
 
     if (GetProvisioningStatus(OC_HIGH_QOS, szQueryUri, &clientResponse->devAddr) != OC_STACK_OK) {
         ErrorCallback(DEVICE_NOT_PROVISIONED);
@@ -180,12 +180,12 @@ bool ValidateEasySetupParams(const EnrolleeNWProvInfo *netInfo,
                              OCProvisioningStatusCB provisioningStatusCallback) {
 
     if (netInfo == NULL || strlen(netInfo->netAddressInfo.WIFI.ipAddress) == 0) {
-        OC_LOG(ERROR, ES_WIFI_PROV_TAG, "Request URI is NULL");
+        OIC_LOG(ERROR, ES_WIFI_PROV_TAG, "Request URI is NULL");
         return false;
     }
 
     if (provisioningStatusCallback == NULL) {
-        OC_LOG(ERROR, ES_WIFI_PROV_TAG, "ProvisioningStatusCallback is NULL");
+        OIC_LOG(ERROR, ES_WIFI_PROV_TAG, "ProvisioningStatusCallback is NULL");
         return false;
     }
 
diff --git a/service/easy-setup/mediator/richsdk/SConscript b/service/easy-setup/mediator/richsdk/SConscript
new file mode 100644 (file)
index 0000000..eb4e6ab
--- /dev/null
@@ -0,0 +1,131 @@
+#******************************************************************
+#
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+######################################################################
+# easy-setup Mediator C++[Rich] SDK build script
+######################################################################
+import os.path
+Import('env')
+
+easysetup_path = os.curdir
+
+if env.get('RELEASE'):
+    env.AppendUnique(CCFLAGS = ['-Os'])
+    env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+else:
+    env.AppendUnique(CCFLAGS = ['-g'])
+
+if env.get('LOGGING'):
+    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+# Easysetup provides reference implemenation of Arduino Enrollee.
+# Mediator applications developed on different platforms will be default defining the
+# flag 'REMOTE_ARDUINO_ENROLEE'. If the target Enrollee is not Arduino, the below commented
+# modifications must be enabled instead (and the existing define must be commented).
+#
+##### The following lines must be uncommented, if target Enrollee is not Arduino
+target_enrollee = env.get('ES_TARGET_ENROLLEE')
+if target_enrollee == 'arduino':
+       print "REMOTE_ARDUINO_ENROLEE flag is defined."
+       print "The Mediator application will be working only with Arduino Enrollee."
+       env.AppendUnique(CPPDEFINES = ['REMOTE_ARDUINO_ENROLEE'])
+
+# Add third party libraries
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+
+easy_setup_env = lib_env.Clone()
+target_os = env.get('TARGET_OS')
+
+######################################################################
+# Build flags
+######################################################################
+easy_setup_env.AppendUnique(CPPPATH = ['inc', 'src', '../../inc'])
+
+if target_os not in ['windows', 'winrt']:
+    easy_setup_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+
+if target_os == 'linux':
+   easy_setup_env.AppendUnique(LIBS = ['pthread', 'dl'])
+
+if target_os in ['android']:
+       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
+       if not env.get('RELEASE'):
+               easy_setup_env.AppendUnique(LIBS = ['log'])
+
+if target_os == 'linux':
+       easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+       easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
+       easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
+       if env.get('SECURED') == '1':
+               easy_setup_env.PrependUnique(LIBS = ['ocprovision', 'ocpmapi'])
+
+if target_os in ['android','linux']:
+       easy_setup_env.PrependUnique(CPPPATH = [
+               env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
+               env.get('SRC_DIR') + '/resource/include',
+               env.get('SRC_DIR') + '/resource/csdk/logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/stack/include',
+        env.get('SRC_DIR') + '/resource/csdk/logger/include',
+               env.get('SRC_DIR') + '/resource/csdk/security/include',
+               env.get('SRC_DIR') + '/extlibs/cjson',
+               env.get('SRC_DIR') + '/extlibs/sqlite3',
+               env.get('SRC_DIR') + '/service/easy-setup/inc',
+               'inc'])
+       if env.get('SECURED') == '1':
+               easy_setup_env.AppendUnique(CPPPATH = [
+                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
+                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
+                       env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm'])
+
+######################################################################
+# Source files and Targets
+######################################################################
+
+
+print"easysetup_path %s" % easysetup_path
+
+es_src = None
+
+if target_os in ['android','linux']:
+       if env.get('SECURED') == '1':
+               env.AppendUnique(es_src = [os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
+
+       es_common_src = ['src/RemoteEnrollee.cpp',
+               'src/RemoteEnrolleeResource.cpp',
+               'src/EasySetup.cpp',
+               'src/ESException.cpp']
+
+       env.AppendUnique(es_src = es_common_src)
+
+       es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich', env.get('es_src'))
+       easy_setup_env.InstallTarget(es_sdk_shared, 'libESMediatorRich')
+
+print "Files path is %s" % env.get('es_src')
+
+#Go to build sample apps
+if target_os == 'linux':
+       SConscript('../../sampleapp/mediator/linux/richsdk_sample/SConscript')
+
+
@@ -8,11 +8,13 @@ buildscript {
         classpath 'com.android.tools.build:gradle:1.2.3'
     }
 }
+
 allprojects {
     repositories {
         jcenter()
     }
 }
+
 android {
     compileSdkVersion 21
     buildToolsVersion '21.1.2'
@@ -1,27 +1,29 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-public abstract class OnBoardingCallback {\r
-    public abstract void onFinished(OnBoardingConnection connection);\r
-}\r
+/**
+ * ***************************************************************
+ * <p/>
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ * <p/>
+ * <p/>
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ * ****************************************************************
+ */
+
+package org.iotivity.service.easysetup.mediator;
+
+public interface IProvisionStatusNativeHandler {
+
+    public void onStatusRecieved(int state);
+
+}
@@ -1,7 +1,7 @@
 /**
  * ***************************************************************
  * <p/>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  * <p/>
  * <p/>
  * <p/>
@@ -33,8 +33,6 @@ public class RemoteEnrollee{
     private native void nativeStartProvision();
     private native void nativeStopProvision();
     private native void nativeRegisterProvisioningHandler(IProvisionStatusNativeHandler listener);
-   //private IProvisionStatusNativeHandler provisioningListener;
-
 
     /* constructor will be invoked from the native layer */
     private RemoteEnrollee(long nativeHandle){
@@ -1,20 +1,5 @@
 LOCAL_PATH := $(call my-dir)
 
-ifeq ($(strip $(ANDROID_NDK)),)
-$(error ANDROID_NDK is not set!)
-endif
-
-$(warning "Current path" $(LOCAL_PATH))
-$(info TC_PREFIX=$(TOOLCHAIN_PREFIX))
-$(info CFLAGS=$(TARGET_CFLAGS))
-$(info CXXFLAGS=$(TARGET_CXXFLAGS) $(TARGET_NO_EXECUTE_CFLAGS))
-$(info CPPFLAGS=$(TARGET_CPPFLAGS))
-$(info CPPPATH=$(TARGET_C_INCLUDES) $(__ndk_modules.$(APP_STL).EXPORT_C_INCLUDES))
-$(info SYSROOT=$(SYSROOT_LINK))
-$(info LDFLAGS=$(TARGET_LDFLAGS) $(TARGET_NO_EXECUTE_LDFLAGS) $(TARGET_NO_UNDEFINED_LDFLAGS) $(TARGET_RELRO_LDFLAGS))
-$(info TC_VER=$(TOOLCHAIN_VERSION))
-$(info PLATFORM=$(APP_PLATFORM))
-
 include $(CLEAR_VARS)
 OIC_LIB_PATH := ../../../../../../out/android/$(TARGET_ARCH_ABI)/debug
 LOCAL_MODULE := android-octbstack
@@ -30,8 +15,8 @@ include $(PREBUILT_SHARED_LIBRARY)
 include $(CLEAR_VARS)
 OIC_LIB_PATH := ../../../../../../out/android/$(TARGET_ARCH_ABI)/debug
 LOCAL_MODULE := android-easysetup
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libESSDK.a
-include $(PREBUILT_STATIC_LIBRARY)
+LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libESMediatorRich.so
+include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
 
@@ -50,15 +35,13 @@ LOCAL_CPPFLAGS += -std=c++0x -frtti -fexceptions
 
 $(info CPPFLAGSUPDATED=$(LOCAL_CPPFLAGS))
 
-NDK_ROOT         := /home/madan/android-ndk-r10d
-
 LOCAL_C_INCLUDES := $(LOCAL_PATH) \
-                                       $(LOCAL_PATH)/jniutil/inc \
-                                       $(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/mediator/inc \
-                                       $(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/mediator/src \
-                                       $(LOCAL_PATH)/../../../../../../service/easy-setup/sdk/common \
+                                       $(LOCAL_PATH)/../../inc \
+                                       $(LOCAL_PATH)/../../src \
+                                       $(LOCAL_PATH)/../../../../inc \
                                        $(LOCAL_PATH)/../../../../../../resource/csdk/logger/include \
-                                       $(LOCAL_PATH)/../../../../../../resource/csdk/connectivity/common/inc \
+                                   $(LOCAL_PATH)/../../../../../../resource/csdk/connectivity/common/inc \
+                                       $(LOCAL_PATH)/../../../../../../resource/c_common/oic_string/include \
                                        $(LOCAL_PATH)/../../../../../../resource/include \
                                        $(LOCAL_PATH)/../../../../../../resource/c_common \
                                        $(LOCAL_PATH)/../../../../../../resource/oc_logger/include \
@@ -71,16 +54,13 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
                                        $(LOCAL_PATH)/../../../../../../extlibs/boost/boost_1_58_0 \
                     $(LOCAL_PATH)/../../../../../../extlibs/timer \
                                        $(LOCAL_PATH)/../../../../../../android/android_api/base/jni \
-                                       $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/include \
-                    $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)/include \
-                                       
-LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/jni_easy_setup.cpp))
-LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/jniutil/src/*.cpp))
 
-LOCAL_LDLIBS := -llog 
-LOCAL_LDLIBS += -L$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/$(TOOLCHAIN_VERSION)/libs/$(TARGET_ARCH_ABI)
-LOCAL_SHARED_LIBRARIES := android-easysetup
+LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.cpp))
+LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.h))
+
+LOCAL_LDLIBS := -llog
 LOCAL_SHARED_LIBRARIES += android-connectivity_abstraction
 LOCAL_SHARED_LIBRARIES += android-octbstack
+LOCAL_SHARED_LIBRARIES += android-easysetup
 
 include $(BUILD_SHARED_LIBRARY)
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -31,6 +31,7 @@
 #include <string>
 
 #include "escommon.h"
+#include "Utility.h"
 #include "octypes.h"
 
 #include "JniJvm.h"
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -29,6 +29,7 @@
 
 #include "RemoteEnrollee.h"
 #include "escommon.h"
+#include "Utility.h"
 
 #include "JniJvm.h"
 
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -1,6 +1,6 @@
 /******************************************************************
  *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
  *
  *
  *
@@ -29,6 +29,7 @@
 
 #include "RemoteEnrollee.h"
 #include "escommon.h"
+#include "Utility.h"
 #include "ESException.h"
 
 #include "JniJvm.h"
@@ -1,78 +1,79 @@
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#ifndef EASYSETUP_H_\r
-#define EASYSETUP_H_\r
-\r
-#include <memory>\r
-#include <vector>\r
-\r
-#include "escommon.h"\r
-#include "RemoteEnrollee.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        class RemoteEnrollee;\r
-\r
-        /**\r
-         * This provides methods for Mediator devices to perform EasySetup of Enrollee devices.\r
-         * EasySetup involves\r
-         * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee\r
-         * devices.\r
-         * 2) Provisioning of Enrollee devices using the credentails of target Enroller devices.\r
-         */\r
-        class EasySetup\r
-        {\r
-        public:\r
-            /**\r
-             * API for getting the instance of EasySetup singleton class.\r
-             * @return EasySetup instance.\r
-             */\r
-            static EasySetup* getInstance();\r
-\r
-            /**\r
-             * This API is used for creating a remote Enrollee device instance.\r
-             * @param enrolleeNWProvIndo Provisioning information for configuring the Enrollee.\r
-             *\r
-             * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same\r
-             *         provisioning information.\r
-             *\r
-             * @return Pointer to RemoteEnrollee instance.\r
-             */\r
-            std::shared_ptr<RemoteEnrollee> createEnrolleeDevice (\r
-                                            const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
-        private:\r
-            EasySetup();\r
-            ~EasySetup();\r
-\r
-            RemoteEnrollee::shared_ptr findDeviceInProvisioningList(\r
-                                const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
-            bool addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee);\r
-            bool deleteDeviceFromProvisioningList (const EnrolleeNWProvInfo& enrolleeNWProvInfo);\r
-\r
-            std::vector< RemoteEnrollee::shared_ptr > m_activeEnrolleeList;\r
-            static EasySetup *s_instance;\r
-        };\r
-    }\r
-}\r
-\r
-#endif /* EASYSETUP_H_ */\r
+//******************************************************************
+//
+// 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 "escommon.h"
+#include "Utility.h"
+#include "RemoteEnrollee.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class RemoteEnrollee;
+
+        /**
+         * This provides methods for Mediator devices to perform EasySetup of Enrollee devices.
+         * EasySetup involves
+         * 1) Ownership transfer for enabling secured communication between Mediator and Enrollee
+         * devices.
+         * 2) Provisioning of Enrollee devices using the credentails of target Enroller devices.
+         */
+        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 device instance.
+             * @param enrolleeNWProvIndo Provisioning information for configuring the Enrollee.
+             *
+             * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same
+             *         provisioning information.
+             *
+             * @return Pointer to RemoteEnrollee instance.
+             */
+            std::shared_ptr<RemoteEnrollee> createEnrolleeDevice (
+                                            const EnrolleeNWProvInfo& enrolleeNWProvInfo);
+        private:
+            EasySetup();
+            ~EasySetup();
+
+            RemoteEnrollee::shared_ptr findDeviceInProvisioningList(
+                                const EnrolleeNWProvInfo& enrolleeNWProvInfo);
+            bool addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee);
+            bool deleteDeviceFromProvisioningList (const EnrolleeNWProvInfo& enrolleeNWProvInfo);
+
+            std::vector< RemoteEnrollee::shared_ptr > m_activeEnrolleeList;
+            static EasySetup *s_instance;
+        };
+    }
+}
+
+#endif /* EASYSETUP_H_ */
@@ -1,79 +1,71 @@
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#ifndef ENROLLEE_SECURITY_H_\r
-#define ENROLLEE_SECURITY_H_\r
-\r
-#include <functional>\r
-\r
-#include "escommon.h"\r
-#include "OCProvisioningManager.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-#define ENROLEE_SECURITY_TAG "ENROLEE_SECURITY"\r
-\r
-        class RemoteEnrolleeResource;\r
-        class OCSecureResource;\r
-\r
-        /**\r
-         * This class contains the methods needed for security  layer interaction.\r
-         *\r
-         * @see EnrolleeSecurity\r
-         */\r
-        class EnrolleeSecurity\r
-        {\r
-        public:\r
-            EnrolleeSecurity(std::shared_ptr< RemoteEnrolleeResource > remoteEnrolleeResource,\r
-            std::string secDbPath);\r
-\r
-            ESResult registerCallbackHandler(EnrolleeSecStatusCb enrolleeSecStatusCb,\r
-                    SecurityPinCb securityPinCb, SecProvisioningDbPathCb secProvisioningDbPathCb);\r
-\r
-            EasySetupState performOwnershipTransfer();\r
-\r
-            ESResult provisionCreds();\r
-\r
-            ESResult provisionAcl();\r
-\r
-        private:\r
-            std::shared_ptr< RemoteEnrolleeResource > m_remoteEnrolleeResource;\r
-            EnrolleeSecStatusCb m_enrolleeSecStatusCb;\r
-            SecurityPinCb m_securityPinCb;\r
-            SecProvisioningDbPathCb m_secProvisioningDbPathCb;\r
-            std::shared_ptr< OC::OCSecureResource > m_unownedDevice;\r
-\r
-            EnrolleeSecState m_enrolleeSecState;std::shared_ptr< OC::OCSecureResource > m_securedResource;\r
-\r
-            std::shared_ptr< OC::OCSecureResource > findEnrollee(std::string host,\r
-                    OC::DeviceList_t &list);\r
-            void provisionCb(OC::PMResultList_t *result, int hasError);\r
-            void ownershipTransferCb(OC::PMResultList_t *result, int hasError);\r
-            void convertUUIDToString(OicUuid_t uuid, std::string& uuidString);\r
-            ESResult createProvisiongResourceACL(OicSecAcl_t *acl);\r
-            int CalculateAclPermission(const char *temp_pms, uint16_t *pms);\r
-        };\r
-    }\r
-}\r
-\r
-#endif /* ENROLLEE_SECURITY_H_*/\r
-\r
+//******************************************************************
+//
+// 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 "escommon.h"
+#include "Utility.h"
+#include "OCProvisioningManager.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+#define ENROLEE_SECURITY_TAG "ENROLEE_SECURITY"
+
+        class RemoteEnrolleeResource;
+        class OCSecureResource;
+
+        /**
+         * This class contains the methods needed for security  layer interaction.
+         *
+         * @see EnrolleeSecurity
+         */
+        class EnrolleeSecurity
+        {
+        public:
+            EnrolleeSecurity(std::shared_ptr< RemoteEnrolleeResource > remoteEnrolleeResource,
+            std::string secDbPath);
+            ESResult registerCallbackHandler(EnrolleeSecStatusCb enrolleeSecStatusCb,
+                    SecurityPinCb securityPinCb, SecProvisioningDbPathCb secProvisioningDbPathCb);
+            EasySetupState performOwnershipTransfer();
+
+        private:
+            std::shared_ptr< RemoteEnrolleeResource > m_remoteEnrolleeResource;
+            EnrolleeSecStatusCb m_enrolleeSecStatusCb;
+            SecurityPinCb m_securityPinCb;
+            SecProvisioningDbPathCb m_secProvisioningDbPathCb;
+            std::shared_ptr< OC::OCSecureResource > m_unownedDevice;
+
+            EnrolleeSecState m_enrolleeSecState;std::shared_ptr< OC::OCSecureResource > m_securedResource;
+
+            std::shared_ptr< OC::OCSecureResource > findEnrollee(std::string host,
+                    OC::DeviceList_t &list);
+            void ownershipTransferCb(OC::PMResultList_t *result, int hasError);
+            void convertUUIDToString(OicUuid_t uuid, std::string& uuidString);
+        };
+    }
+}
+
+#endif /* ENROLLEE_SECURITY_H_*/
+
old mode 100755 (executable)
new mode 100644 (file)
similarity index 97%
rename from service/easy-setup/sdk/mediator/include/RemoteEnrollee.h
rename to service/easy-setup/mediator/richsdk/inc/RemoteEnrollee.h
index fbd273d..478808a
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#ifndef REMOTE_ENROLLEE_H_\r
-#define REMOTE_ENROLLEE_H_\r
-\r
-#include "escommon.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        class RemoteEnrolleeResource;\r
-        class EnrolleeSecurity;\r
-\r
-        /**\r
-         * This class represents Remote Enrollee device instance.\r
-         * It will provide APIs for Mediator to perform operations to enable the Enrollee device\r
-         * to connect to the Enroller.\r
-         */\r
-        class RemoteEnrollee\r
-        {\r
-        public:\r
-            /**\r
-             * RemoteEnrollee constructor\r
-             *\r
-             * @param enrolleeNWProvInfo Provisioning information for the Enrollee\r
-             *\r
-             * @throw ESBadRequestException is thrown if the parameters are invalid\r
-             */\r
-            RemoteEnrollee(const EnrolleeNWProvInfo& enrolleeNWProvInfo) ;\r
-\r
-            ~RemoteEnrollee() = default;\r
-\r
-            typedef std::shared_ptr< RemoteEnrollee > shared_ptr;\r
-\r
-            /**\r
-             * Callback definition to be invoked when EasySetup status is changed.\r
-             * The same callback will be invoked when there is an error in the\r
-             * EasySetup process.\r
-             *\r
-             * @see registerResourceHandler\r
-             * @see ResourceState\r
-             */\r
-            typedef std::function< void(std::shared_ptr< EasySetupStatus >) >\r
-                                                                        EasySetupStatusCB;\r
-\r
-#ifdef __WITH_DTLS__\r
-            /**\r
-             * Register Security status and other information callback handlers.\r
-             *\r
-             * @param secProvisioningDbCb Callback to be invoked when the stack expects a\r
-             *        path for the provisioning db.\r
-             * @param securityPinCb Callback to get security pin during pin based ownership transfer.\r
-             *\r
-             * @throws InvalidParameterException If callback is an empty function or null.\r
-             * @throws ESBadRequestException If registration is already completed.\r
-             *\r
-             * @see SecProvisioningResult\r
-             */\r
-            ESResult registerSecurityCallbackHandler(SecurityPinCb securityPinCb,\r
-                    SecProvisioningDbPathCb secProvisioningDbPathCb);\r
-#endif //__WITH_DTLS__\r
-\r
-            /**\r
-             * Register EasySetup status handler.\r
-             *\r
-             * @param callback Callback to get EasySetup status.\r
-             * @param secProvisioningDbCB Callback to be invoked when the stack expects a\r
-             *        path for the provisioning db.\r
-             *\r
-             * @throws InvalidParameterException If callback is an empty function or null.\r
-             * @throws ESBadRequestException If registration is already completed.\r
-             *\r
-             * @see EasySetupStatus\r
-             */\r
-            void registerEasySetupStatusHandler(EasySetupStatusCB callback);\r
-\r
-            /**\r
-             * Start provisioning of target Enrollers information to the Enrollee.\r
-             *\r
-             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.\r
-             *\r
-             * @see RemoteEnrollee\r
-             */\r
-            void startProvisioning();\r
-\r
-            /**\r
-             * Stop provisioning process that is currently in progress.\r
-             *\r
-             * @throws BadRequestException If provisioning is not in progress.\r
-             */\r
-            void stopProvisioning();\r
-\r
-            /**\r
-             * Check if the Enrollee device provisioned.\r
-             */\r
-            bool isEnrolleeProvisioned();\r
-\r
-            /**\r
-             * Get the Provisioning information provided for the current Enrollee.\r
-             *\r
-             * @return EnrolleeNWProvInfo Provisioning information provided for the current Enrollee.\r
-             */\r
-            EnrolleeNWProvInfo& getEnrolleeProvisioningInfo ();\r
-\r
-        private:\r
-            std::shared_ptr< RemoteEnrolleeResource > m_remoteResource;\r
-            EasySetupStatusCB m_easySetupStatusCb;\r
-            EnrolleeSecStatusCb m_enrolleeSecStatusCb;\r
-            SecurityPinCb m_securityPinCb;\r
-            SecProvisioningDbPathCb m_secProvisioningDbPathCb;\r
-            EnrolleeNWProvInfo m_enrolleeNWProvInfo;\r
-            std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity;\r
-            CurrentESState m_currentESState;\r
-            bool m_needSecuredEasysetup;\r
-\r
-            void provisioningStatusHandler (std::shared_ptr< ProvisioningStatus > provStatus);\r
-            void easySetupSecurityStatusCallback(\r
-            std::shared_ptr< SecProvisioningResult > secProvisioningResult);\r
-        };\r
-    }\r
-}\r
-\r
-#endif //REMOTE_ENROLLEE_H_\r
+//******************************************************************
+//
+// 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 "escommon.h"
+#include "Utility.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        class RemoteEnrolleeResource;
+        class EnrolleeSecurity;
+
+        /**
+         * This class represents Remote Enrollee device instance.
+         * It will provide APIs for Mediator to perform operations to enable the Enrollee device
+         * to connect to the Enroller.
+         */
+        class RemoteEnrollee
+        {
+        public:
+            /**
+             * RemoteEnrollee constructor
+             *
+             * @param enrolleeNWProvInfo Provisioning information for the Enrollee
+             *
+             * @throw ESBadRequestException is thrown if the parameters are invalid
+             */
+            RemoteEnrollee(const EnrolleeNWProvInfo& enrolleeNWProvInfo) ;
+
+            ~RemoteEnrollee() = default;
+
+            typedef std::shared_ptr< RemoteEnrollee > shared_ptr;
+
+            /**
+             * Callback definition to be invoked when EasySetup status is changed.
+             * The same callback will be invoked when there is an error in the
+             * EasySetup process.
+             *
+             * @see registerResourceHandler
+             * @see ResourceState
+             */
+            typedef std::function< void(std::shared_ptr< EasySetupStatus >) >
+                                                                        EasySetupStatusCB;
+
+#ifdef __WITH_DTLS__
+            /**
+             * Register Security status and other information callback handlers.
+             *
+             * @param secProvisioningDbCb Callback to be invoked when the stack expects a
+             *        path for the provisioning db.
+             * @param securityPinCb Callback to get security pin during pin based ownership transfer.
+             *
+             * @throws InvalidParameterException If callback is an empty function or null.
+             * @throws ESBadRequestException If registration is already completed.
+             *
+             * @see SecProvisioningResult
+             */
+            ESResult registerSecurityCallbackHandler(SecurityPinCb securityPinCb,
+                    SecProvisioningDbPathCb secProvisioningDbPathCb);
+#endif //__WITH_DTLS__
+
+            /**
+             * Register EasySetup status handler.
+             *
+             * @param callback Callback to get EasySetup status.
+             * @param secProvisioningDbCB Callback to be invoked when the stack expects a
+             *        path for the provisioning db.
+             *
+             * @throws InvalidParameterException If callback is an empty function or null.
+             * @throws ESBadRequestException If registration is already completed.
+             *
+             * @see EasySetupStatus
+             */
+            void registerEasySetupStatusHandler(EasySetupStatusCB callback);
+
+            /**
+             * Start provisioning of target Enrollers information to the Enrollee.
+             *
+             * @throws ESBadRequestException If RemoteEnrollee device not created prior to this call.
+             *
+             * @see RemoteEnrollee
+             */
+            void startProvisioning();
+
+            /**
+             * Stop provisioning process that is currently in progress.
+             *
+             * @throws BadRequestException If provisioning is not in progress.
+             */
+            void stopProvisioning();
+
+            /**
+             * Check if the Enrollee device provisioned.
+             */
+            bool isEnrolleeProvisioned();
+
+            /**
+             * Get the Provisioning information provided for the current Enrollee.
+             *
+             * @return EnrolleeNWProvInfo Provisioning information provided for the current Enrollee.
+             */
+            EnrolleeNWProvInfo& getEnrolleeProvisioningInfo ();
+
+        private:
+            std::shared_ptr< RemoteEnrolleeResource > m_remoteResource;
+            EasySetupStatusCB m_easySetupStatusCb;
+            EnrolleeSecStatusCb m_enrolleeSecStatusCb;
+            SecurityPinCb m_securityPinCb;
+            SecProvisioningDbPathCb m_secProvisioningDbPathCb;
+            EnrolleeNWProvInfo m_enrolleeNWProvInfo;
+            std::shared_ptr< EnrolleeSecurity > m_enrolleeSecurity;
+            CurrentESState m_currentESState;
+            bool m_needSecuredEasysetup;
+
+            void provisioningStatusHandler (std::shared_ptr< ProvisioningStatus > provStatus);
+            void easySetupSecurityStatusCallback(
+            std::shared_ptr< SecProvisioningResult > secProvisioningResult);
+        };
+    }
+}
+
+#endif //REMOTE_ENROLLEE_H_
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#ifndef REMOTE_ENROLLEE_RESOURCE_H_\r
-#define REMOTE_ENROLLEE_RESOURCE_H_\r
-\r
-#include <mutex>\r
-#include <memory>\r
-\r
-#include "escommon.h"\r
-\r
-#include "OCApi.h"\r
-\r
-using namespace OC;\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        class OCResource;\r
-        class EnrolleeSecurity;\r
-\r
-        /**\r
-         * This class contains the resource discovery methods.\r
-         *\r
-         * @see RemoteEnrolleeResource\r
-         */\r
-        class RemoteEnrolleeResource\r
-        {\r
-            friend class EnrolleeSecurity;\r
-\r
-        public:\r
-            typedef std::shared_ptr< RemoteEnrolleeResource > Ptr;\r
-\r
-            typedef std::function< void(std::shared_ptr< ProvisioningStatus >) > ProvStatusCb;\r
-\r
-            /**\r
-             * RemoteEnrolleeResource constructor\r
-             *\r
-             * @param enrolleeNWProvInfo Provisioning information for the Enrollee\r
-             *\r
-             * @throw ESBadRequestException is thrown if the parameters are invalid\r
-             */\r
-            RemoteEnrolleeResource(EnrolleeNWProvInfo enrolleeNWProvInfo);\r
-\r
-            ~RemoteEnrolleeResource() = default;\r
-\r
-            /**\r
-             * Register provisioning status handler.\r
-             *\r
-             * @param callback Callback to get Provisioning status.\r
-             *\r
-             * @throws InvalidParameterException If callback is an empty function or null.\r
-             * @throws ESBadRequestException If registration is already completed.\r
-             *\r
-             * @see ProvisioningStatus\r
-             */\r
-            void registerProvStatusCallback (ProvStatusCb provStatusCb);\r
-\r
-            /**\r
-             * Construct Remote OIC resource using the enrollee host and connectivity information\r
-             * provided in the constructor of RemoteEnrolleeResource.\r
-             *\r
-             * @throws InvalidParameterException If the provided information is invalid.\r
-             * @throws ESBadRequestException If resource is already constructed.\r
-             *\r
-             * @see ProvisioningStatus\r
-             */\r
-            ESResult constructResourceObject();\r
-\r
-            /**\r
-             * Function for provisioning of Remote Enrollee resource using the information provided.\r
-             *\r
-             * @throws InvalidParameterException If cb is empty.\r
-             */\r
-            void provisionEnrollee();\r
-\r
-            /**\r
-             * Function for unprovisioning of Remote Enrollee and bring to unprovisioned state\r
-             *\r
-             * @throws ESBadRequestException If device is not provisioned already.\r
-             */\r
-            void unprovisionEnrollee();\r
-\r
-\r
-\r
-        private:\r
-            std::shared_ptr< OC::OCResource > m_ocResource;\r
-            std::mutex m_mutex;\r
-            ProvStatusCb m_provStatusCb;\r
-            EnrolleeNWProvInfo m_enrolleeNWProvInfo;\r
-            bool m_discoveryResponse;\r
-\r
-            void getProvStatusResponse(const HeaderOptions& headerOptions, const OCRepresentation& rep,\r
-                    const int eCode);\r
-\r
-            void checkProvInformationCb(const HeaderOptions& headerOptions, const OCRepresentation& rep,\r
-                    const int eCode);\r
-\r
-            ESResult ESDiscoveryTimeout(unsigned short waittime);\r
-\r
-            void onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource);\r
-        };\r
-    }\r
-}\r
-#endif\r
+//******************************************************************
+//
+// 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_RESOURCE_H_
+#define REMOTE_ENROLLEE_RESOURCE_H_
+
+#include <mutex>
+#include <memory>
+
+#include "escommon.h"
+#include "Utility.h"
+
+#include "OCApi.h"
+
+using namespace OC;
+
+namespace OIC
+{
+    namespace Service
+    {
+        class OCResource;
+        class EnrolleeSecurity;
+
+        /**
+         * This class contains the resource discovery methods.
+         *
+         * @see RemoteEnrolleeResource
+         */
+        class RemoteEnrolleeResource
+        {
+            friend class EnrolleeSecurity;
+
+        public:
+            typedef std::shared_ptr< RemoteEnrolleeResource > Ptr;
+
+            typedef std::function< void(std::shared_ptr< ProvisioningStatus >) > ProvStatusCb;
+
+            /**
+             * RemoteEnrolleeResource constructor
+             *
+             * @param enrolleeNWProvInfo Provisioning information for the Enrollee
+             *
+             * @throw ESBadRequestException is thrown if the parameters are invalid
+             */
+            RemoteEnrolleeResource(EnrolleeNWProvInfo enrolleeNWProvInfo);
+
+            ~RemoteEnrolleeResource() = default;
+
+            /**
+             * Register provisioning status handler.
+             *
+             * @param callback Callback to get Provisioning status.
+             *
+             * @throws InvalidParameterException If callback is an empty function or null.
+             * @throws ESBadRequestException If registration is already completed.
+             *
+             * @see ProvisioningStatus
+             */
+            void registerProvStatusCallback (ProvStatusCb provStatusCb);
+
+            /**
+             * Construct Remote OIC resource using the enrollee host and connectivity information
+             * provided in the constructor of RemoteEnrolleeResource.
+             *
+             * @throws InvalidParameterException If the provided information is invalid.
+             * @throws ESBadRequestException If resource is already constructed.
+             *
+             * @see ProvisioningStatus
+             */
+            ESResult constructResourceObject();
+
+            /**
+             * Function for provisioning of Remote Enrollee resource using the information provided.
+             *
+             * @throws InvalidParameterException If cb is empty.
+             */
+            void provisionEnrollee();
+
+            /**
+             * Function for unprovisioning of Remote Enrollee and bring to unprovisioned state
+             *
+             * @throws ESBadRequestException If device is not provisioned already.
+             */
+            void unprovisionEnrollee();
+
+
+
+        private:
+            std::shared_ptr< OC::OCResource > m_ocResource;
+            std::mutex m_mutex;
+            ProvStatusCb m_provStatusCb;
+            EnrolleeNWProvInfo m_enrolleeNWProvInfo;
+            bool m_discoveryResponse;
+
+            void getProvStatusResponse(const HeaderOptions& headerOptions, const OCRepresentation& rep,
+                    const int eCode);
+
+            void checkProvInformationCb(const HeaderOptions& headerOptions, const OCRepresentation& rep,
+                    const int eCode);
+
+            ESResult ESDiscoveryTimeout(unsigned short waittime);
+
+            void onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource);
+        };
+    }
+}
+#endif
diff --git a/service/easy-setup/mediator/richsdk/inc/Utility.h b/service/easy-setup/mediator/richsdk/inc/Utility.h
new file mode 100644 (file)
index 0000000..2293464
--- /dev/null
@@ -0,0 +1,154 @@
+//******************************************************************
+//
+// 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 UTILITY_H_
+#define UTILITY_H_
+
+#ifndef WITH_ARDUINO
+#include <memory>
+#endif
+
+#include "ocstack.h"
+#include "octypes.h"
+
+#ifndef WITH_ARDUINO
+namespace OIC
+{
+    namespace Service
+    {
+        typedef enum
+        {
+            ES_PROVISIONING_ERROR = -1,
+            ES_NEED_PROVISIONING,
+            ES_PROVISIONED_ALREADY,
+            ES_PROVISIONING_SUCCESS
+        } ESState;
+
+        typedef enum
+        {
+            ES_UNKNOWN = 0,
+            ES_ONBOARDED,
+            ES_OWNED,
+            ES_PROVISIONED
+        } CurrentESState;
+
+        typedef enum
+        {
+            ES_SEC_UNKNOWN = 0,
+            ES_SEC_OWNED,
+            ES_SEC_ACL_PROVISIONED,
+            ES_SEC_CREDS_PROVISIONED
+        } EnrolleeSecState;
+
+        /**
+         * Security Provisioning Status
+         */
+        class SecProvisioningResult
+        {
+        public:
+            std::shared_ptr< SecProvisioningResult > shared_ptr;
+            SecProvisioningResult(std::string deviceUUID, ESResult result) :
+                m_devUUID(deviceUUID), m_result(result)
+            {
+
+            }
+
+            std::string getDeviceUUID()
+            {
+                return m_devUUID;
+            }
+
+            ESResult getResult()
+            {
+                return m_result;
+            }
+        private:
+            std::string m_devUUID;
+            ESResult m_result;
+        };
+
+        /**
+         * Callback function definition for providing Enrollee security status .
+         */
+        typedef std::function< void(std::shared_ptr<SecProvisioningResult>) > EnrolleeSecStatusCb;
+
+        /**
+         * Callback definition to be invoked when the security stack expects a pin from application.
+         */
+        typedef std::function< void(std::string&) > SecurityPinCb;
+
+        /**
+         * Callback definition to be invoked when the stack expects a db path.
+         */
+        typedef std::function< void(std::string&) > SecProvisioningDbPathCb;
+
+        class ProvisioningStatus
+        {
+        public:
+            std::shared_ptr< ProvisioningStatus > shared_ptr;
+            ProvisioningStatus(ESResult result, ESState esState) :
+                    m_result(result), m_esState(esState)
+            {
+
+            }
+
+            ESResult& getESResult()
+            {
+                return m_result;
+            }
+
+            ESState& getESState()
+            {
+                return m_esState;
+            }
+        private:
+            ESResult m_result;
+            ESState m_esState;
+        };
+
+        class EasySetupStatus
+        {
+        public:
+            std::shared_ptr< EasySetupStatus > shared_ptr;
+            EasySetupStatus(const EasySetupState& easySetupState,
+                    const EnrolleeNWProvInfo& enrolleeNWProvInfo) :
+                    m_easySetupState(easySetupState), m_enrolleeNWProvInfo(enrolleeNWProvInfo)
+            {
+
+            }
+
+            EnrolleeNWProvInfo& getEasySetupNWProvInfo()
+            {
+                return m_enrolleeNWProvInfo;
+            }
+
+            EasySetupState& getEasySetupState()
+            {
+                return m_easySetupState;
+            }
+        private:
+            EasySetupState m_easySetupState;
+            EnrolleeNWProvInfo m_enrolleeNWProvInfo;
+        };
+    }
+}
+#endif //WITH_ARDUINO
+
+#endif //UTILITY_H_
\ No newline at end of file
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#include "EasySetup.h"\r
-\r
-#include "logger.h"\r
-#include "ESException.h"\r
-#include "RemoteEnrollee.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        #define EASYSETUP_TAG "EASY_SETUP"\r
-\r
-        EasySetup * EasySetup::s_instance = nullptr;\r
-\r
-        EasySetup::EasySetup()\r
-        {\r
-\r
-        }\r
-\r
-        EasySetup* EasySetup::getInstance ()\r
-        {\r
-            if (s_instance == nullptr)\r
-            {\r
-                s_instance = new EasySetup ();\r
-            }\r
-            return s_instance;\r
-        }\r
-\r
-        RemoteEnrollee::shared_ptr EasySetup::findDeviceInProvisioningList (\r
-                            const EnrolleeNWProvInfo& enrolleeNWProvInfo)\r
-        {\r
-            OC_LOG(DEBUG,EASYSETUP_TAG,"Entered findDeviceInProvisioningList ()");\r
-\r
-            std::vector< std::shared_ptr< RemoteEnrollee > >::iterator it;\r
-\r
-            std::shared_ptr< RemoteEnrollee > remoteEnrollee = nullptr;\r
-            for(auto it : m_activeEnrolleeList)\r
-            {\r
-                OC_LOG_V(DEBUG,EASYSETUP_TAG,"entered the iterator");\r
-\r
-                if (0 == memcmp(&it->getEnrolleeProvisioningInfo().netAddressInfo,\r
-                                &enrolleeNWProvInfo.netAddressInfo, sizeof(EnrolleeNWProvInfo)))\r
-                {\r
-                    remoteEnrollee = it;\r
-                    return remoteEnrollee;\r
-                }\r
-            }\r
-\r
-            OC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for  findDeviceInProvisioningList call");\r
-            return remoteEnrollee;\r
-        }\r
-\r
-        bool EasySetup::addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee)\r
-        {\r
-            for (auto it : m_activeEnrolleeList)\r
-            {\r
-                if (0 == memcmp(&it->getEnrolleeProvisioningInfo().netAddressInfo,\r
-                                &remoteEnrollee->getEnrolleeProvisioningInfo().netAddressInfo,\r
-                                sizeof(EnrolleeNWProvInfo)))\r
-                {\r
-                    return false;\r
-                }\r
-            }\r
-\r
-            OC_LOG_V(DEBUG,EASYSETUP_TAG,"Adding new device RemoteEnrollee list");\r
-            m_activeEnrolleeList.push_back(remoteEnrollee);\r
-            return true;\r
-        }\r
-\r
-        std::shared_ptr<RemoteEnrollee> EasySetup::createEnrolleeDevice (\r
-                                        const EnrolleeNWProvInfo& enrolleeNWProvInfo)\r
-        {\r
-            if (findDeviceInProvisioningList(enrolleeNWProvInfo) != nullptr)\r
-            {\r
-                throw ESBadRequestException { "Device already created exception" };\r
-            }\r
-\r
-            RemoteEnrollee::shared_ptr remoteEnrollee;\r
-\r
-            remoteEnrollee = std::make_shared< RemoteEnrollee > (enrolleeNWProvInfo);\r
-\r
-\r
-            if (!addDeviceToProvisioningList (remoteEnrollee))\r
-            {\r
-                return nullptr;\r
-            }\r
-\r
-            return remoteEnrollee;\r
-        }\r
-\r
-\r
-    }\r
-}\r
-\r
+//******************************************************************
+//
+// 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 "logger.h"
+#include "ESException.h"
+#include "RemoteEnrollee.h"
+
+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;
+        }
+
+        RemoteEnrollee::shared_ptr EasySetup::findDeviceInProvisioningList (
+                            const EnrolleeNWProvInfo& enrolleeNWProvInfo)
+        {
+            OC_LOG(DEBUG,EASYSETUP_TAG,"Entered findDeviceInProvisioningList ()");
+
+            std::vector< std::shared_ptr< RemoteEnrollee > >::iterator it;
+
+            std::shared_ptr< RemoteEnrollee > remoteEnrollee = nullptr;
+            for(auto it : m_activeEnrolleeList)
+            {
+                OC_LOG_V(DEBUG,EASYSETUP_TAG,"entered the iterator");
+
+                if (0 == memcmp(&it->getEnrolleeProvisioningInfo().netAddressInfo,
+                                &enrolleeNWProvInfo.netAddressInfo, sizeof(EnrolleeNWProvInfo)))
+                {
+                    remoteEnrollee = it;
+                    return remoteEnrollee;
+                }
+            }
+
+            OC_LOG_V(DEBUG,EASYSETUP_TAG,"Return nullptr for  findDeviceInProvisioningList call");
+            return remoteEnrollee;
+        }
+
+        bool EasySetup::addDeviceToProvisioningList(const RemoteEnrollee::shared_ptr remoteEnrollee)
+        {
+            for (auto it : m_activeEnrolleeList)
+            {
+                if (0 == memcmp(&it->getEnrolleeProvisioningInfo().netAddressInfo,
+                                &remoteEnrollee->getEnrolleeProvisioningInfo().netAddressInfo,
+                                sizeof(EnrolleeNWProvInfo)))
+                {
+                    return false;
+                }
+            }
+
+            OC_LOG_V(DEBUG,EASYSETUP_TAG,"Adding new device RemoteEnrollee list");
+            m_activeEnrolleeList.push_back(remoteEnrollee);
+            return true;
+        }
+
+        std::shared_ptr<RemoteEnrollee> EasySetup::createEnrolleeDevice (
+                                        const EnrolleeNWProvInfo& enrolleeNWProvInfo)
+        {
+            if (findDeviceInProvisioningList(enrolleeNWProvInfo) != nullptr)
+            {
+                throw ESBadRequestException { "Device already created exception" };
+            }
+
+            RemoteEnrollee::shared_ptr remoteEnrollee;
+
+            remoteEnrollee = std::make_shared< RemoteEnrollee > (enrolleeNWProvInfo);
+
+
+            if (!addDeviceToProvisioningList (remoteEnrollee))
+            {
+                return nullptr;
+            }
+
+            return remoteEnrollee;
+        }
+
+
+    }
+}
+
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#include "base64.h"\r
-\r
-#include "EnrolleeSecurity.h"\r
-#include "oxmjustworks.h"\r
-#include "oxmrandompin.h"\r
-#include "RemoteEnrolleeResource.h"\r
-#include "logger.h"\r
-#include "ESException.h"\r
-#include "oic_malloc.h"\r
-#include "oic_string.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        #define MAX_PERMISSION_LENGTH (5)\r
-        #define CREATE (1)\r
-        #define READ (2)\r
-        #define UPDATE (4)\r
-        #define DELETE (8)\r
-        #define NOTIFY (16)\r
-        #define DASH '-'\r
-\r
-        //TODO : Currently discovery timeout for owned and unowned devices is fixed as 5\r
-        // The value should be accepted from the application as a parameter during ocplatform\r
-        // config call\r
-#define ES_SEC_DISCOVERY_TIMEOUT 5\r
-\r
-        EnrolleeSecurity::EnrolleeSecurity(\r
-        std::shared_ptr< RemoteEnrolleeResource > remoteEnrolleeResource,\r
-        std::string secDbPath)\r
-        {\r
-            m_enrolleeSecState = EnrolleeSecState::ES_SEC_UNKNOWN;\r
-            m_remoteEnrolleeResource = remoteEnrolleeResource;\r
-\r
-            //Initializing the provisioning client stack using the db path provided by the\r
-            // application.\r
-            // Note : If the path is NULL or empty, the PDM.db should be present in the same path.\r
-            OCStackResult result = OCSecure::provisionInit(secDbPath);\r
-\r
-            if (result != OC_STACK_OK)\r
-            {\r
-                throw ESPlatformException(result);\r
-            }\r
-        }\r
-\r
-        ESResult EnrolleeSecurity::registerCallbackHandler(EnrolleeSecStatusCb enrolleeSecStatusCb,\r
-                SecurityPinCb securityPinCb, SecProvisioningDbPathCb secProvisioningDbPathCb)\r
-\r
-        {\r
-            m_enrolleeSecStatusCb = enrolleeSecStatusCb;\r
-            m_securityPinCb = securityPinCb;\r
-            m_secProvisioningDbPathCb = secProvisioningDbPathCb;\r
-\r
-            return ES_ERROR;\r
-        }\r
-\r
-        std::shared_ptr< OC::OCSecureResource > EnrolleeSecurity::findEnrollee(std::string host,\r
-                DeviceList_t &list)\r
-        {\r
-            for (unsigned int i = 0; i < list.size(); i++)\r
-            {\r
-                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Device %d ID %s ", i + 1,\r
-                        list[i]->getDeviceID().c_str());OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "From IP :%s", list[i]->getDevAddr().c_str());\r
-\r
-                if (list[i]->getDevAddr() == host)\r
-                {\r
-                    return list[i];\r
-                }\r
-            }\r
-\r
-            return nullptr;\r
-        }\r
-\r
-        void EnrolleeSecurity::convertUUIDToString(OicUuid_t uuid, std::string& uuidString)\r
-        {\r
-            char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*) 0)->id)) + 1] =\r
-            { 0, };\r
-            uint32_t outLen = 0;\r
-            B64Result b64Ret = B64_OK;\r
-            std::ostringstream deviceId("");\r
-\r
-            b64Ret = b64Encode(uuid.id, sizeof(uuid.id),\r
-                    base64Buff, sizeof(base64Buff), &outLen);\r
-\r
-            if (B64_OK == b64Ret)\r
-            {\r
-                deviceId << base64Buff;\r
-            }\r
-            uuidString =  deviceId.str();\r
-        }\r
-\r
-        void EnrolleeSecurity::ownershipTransferCb(OC::PMResultList_t *result, int hasError)\r
-        {\r
-            if (hasError)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG,"Error!!! in OwnershipTransfer");\r
-\r
-                std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;\r
-                std::string uuid;\r
-                convertUUIDToString(result->at(0).deviceId, uuid);\r
-                securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,\r
-                        ES_ERROR);\r
-\r
-                m_enrolleeSecStatusCb(securityProvisioningStatus);\r
-                return;\r
-            }\r
-            else\r
-            {\r
-                OC_LOG(DEBUG, ENROLEE_SECURITY_TAG,"Transferred Ownership successfuly for device : ");\r
-                std::string uuid;\r
-                convertUUIDToString(result->at(0).deviceId, uuid);\r
-                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "UUID : %s",uuid.c_str());\r
-\r
-                //TODO : Decide if we have to manage the owned/unowned devices.\r
-                //pOwnedDevList.push_back(pUnownedDevList[transferDevIdx]);\r
-                //pUnownedDevList.erase(pUnownedDevList.begin() + transferDevIdx);\r
-\r
-                OC_LOG(DEBUG, ENROLEE_SECURITY_TAG,\r
-                        "Ownership transfer success success. Continuing with provisioning ACL");\r
-\r
-                if (provisionAcl() == ES_ERROR)\r
-                {\r
-                    OC_LOG(ERROR, ENROLEE_SECURITY_TAG,"Error!!! in provisionAcl");\r
-                    std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;\r
-                    std::string uuid;\r
-                    convertUUIDToString(result->at(0).deviceId, uuid);\r
-                    securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,\r
-                            ES_ERROR);\r
-                }\r
-\r
-                delete result;\r
-            }\r
-        }\r
-\r
-        /**\r
-         * Callback function for provisioning ACL, Credentials.\r
-         *\r
-         * @param[in]    result Result list\r
-         * @param[in] hasError indicates if the result has error\r
-         */\r
-        void EnrolleeSecurity::provisionCb(OC::PMResultList_t *result, int hasError)\r
-        {\r
-            if (hasError)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "provisionCb : Error in provisioning operation!");\r
-            }\r
-            else\r
-            {\r
-                OC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "provisionCb : Received provisioning results: ");\r
-                for (unsigned int i = 0; i < result->size(); i++)\r
-                {\r
-                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d for device",result->at(i).res);\r
-                    std::string uuid;\r
-                    convertUUIDToString(result->at(0).deviceId, uuid);\r
-\r
-                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "UUID : %s",uuid.c_str());\r
-                    std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;\r
-                    securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,\r
-                            ES_OK);\r
-\r
-                    m_enrolleeSecStatusCb(securityProvisioningStatus);\r
-                    return;\r
-                }\r
-\r
-                delete result;\r
-            }\r
-        }\r
-\r
-        /**\r
-         * Calculate ACL permission from string to bit\r
-         *\r
-         * @param[in] temp_psm    Input data of ACL permission string\r
-         * @param[in,out] pms    The pointer of ACL permission value\r
-         * @return  0 on success otherwise -1.\r
-         */\r
-        int EnrolleeSecurity::CalculateAclPermission(const char *temp_pms, uint16_t *pms)\r
-        {\r
-            int i = 0;\r
-\r
-            if (NULL == temp_pms || NULL == pms)\r
-            {\r
-                return -1;\r
-            }\r
-            *pms = 0;\r
-            while (temp_pms[i] != '\0')\r
-            {\r
-                switch (temp_pms[i])\r
-                {\r
-                    case 'C':\r
-                        {\r
-                            *pms += CREATE;\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    case 'R':\r
-                        {\r
-                            *pms += READ;\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    case 'U':\r
-                        {\r
-                            *pms += UPDATE;\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    case 'D':\r
-                        {\r
-                            *pms += DELETE;\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    case 'N':\r
-                        {\r
-                            *pms += NOTIFY;\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    case '_':\r
-                        {\r
-                            i++;\r
-                            break;\r
-                        }\r
-                    default:\r
-                        {\r
-                            return -1;\r
-                        }\r
-                }\r
-            }\r
-            return 0;\r
-        }\r
-\r
-        EasySetupState EnrolleeSecurity::performOwnershipTransfer()\r
-        {\r
-            EasySetupState ownershipStatus = DEVICE_NOT_OWNED;\r
-\r
-            OC::DeviceList_t pUnownedDevList, pOwnedDevList;\r
-\r
-            pOwnedDevList.clear();\r
-            pUnownedDevList.clear();\r
-\r
-            OCStackResult result;\r
-\r
-            result = OCSecure::discoverOwnedDevices(ES_SEC_DISCOVERY_TIMEOUT,\r
-                    pOwnedDevList);\r
-            if (result != OC_STACK_OK)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Owned Discovery failed.");\r
-                ownershipStatus = DEVICE_NOT_OWNED;\r
-                //Throw exception\r
-                throw ESPlatformException(result);\r
-                return ownershipStatus;\r
-            }\r
-            else if (pOwnedDevList.size())\r
-            {\r
-                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found owned devices. Count =%d",\r
-                        pOwnedDevList.size());\r
-                std::shared_ptr< OC::OCSecureResource > ownedDevice =\r
-                        findEnrollee(\r
-                                std::string(\r
-                                        m_remoteEnrolleeResource->m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress),\r
-                                pOwnedDevList);\r
-                if (ownedDevice)\r
-                {\r
-                    ownershipStatus = DEVICE_OWNED;\r
-                    return ownershipStatus;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No owned devices found.");\r
-                ownershipStatus = DEVICE_NOT_OWNED;\r
-            }\r
-\r
-            result = OCSecure::discoverUnownedDevices(ES_SEC_DISCOVERY_TIMEOUT, pUnownedDevList);\r
-            if (result != OC_STACK_OK)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "UnOwned Discovery failed.");\r
-                ownershipStatus = DEVICE_NOT_OWNED;\r
-                //Throw exception\r
-                throw ESPlatformException(result);\r
-                return ownershipStatus;\r
-            }\r
-            else if (pUnownedDevList.size())\r
-            {\r
-                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found Unowned devices. Count =%d",\r
-                        pUnownedDevList.size());\r
-\r
-                m_unownedDevice =\r
-                        findEnrollee(\r
-                                m_remoteEnrolleeResource->m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress,\r
-                                pUnownedDevList);\r
-                if (m_unownedDevice)\r
-                {\r
-                    OTMCallbackData_t justWorksCBData;\r
-                    justWorksCBData.loadSecretCB = LoadSecretJustWorksCallback;\r
-                    justWorksCBData.createSecureSessionCB = CreateSecureSessionJustWorksCallback;\r
-                    justWorksCBData.createSelectOxmPayloadCB = CreateJustWorksSelectOxmPayload;\r
-                    justWorksCBData.createOwnerTransferPayloadCB =\r
-                            CreateJustWorksOwnerTransferPayload;\r
-                    OCSecure::setOwnerTransferCallbackData(OIC_JUST_WORKS, &justWorksCBData, NULL);\r
-\r
-                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Transfering ownership for : %s ",\r
-                            m_unownedDevice->getDeviceID().c_str());\r
-\r
-                    OC::ResultCallBack ownershipTransferCb = std::bind(\r
-                            &EnrolleeSecurity::ownershipTransferCb, this, std::placeholders::_1,\r
-                            std::placeholders::_2);\r
-\r
-                    if (m_unownedDevice->doOwnershipTransfer(ownershipTransferCb) != OC_STACK_OK)\r
-                    {\r
-                        OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "OwnershipTransferCallback is failed");\r
-                        ownershipStatus = DEVICE_NOT_OWNED;\r
-                        //Throw exception\r
-                        throw ESPlatformException(result);\r
-                    }\r
-                    ownershipStatus = DEVICE_NOT_OWNED;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No unSecure devices found.");\r
-                ownershipStatus = DEVICE_NOT_OWNED;\r
-\r
-                return ownershipStatus;\r
-            }\r
-\r
-            return ownershipStatus;\r
-        }\r
-\r
-        ESResult EnrolleeSecurity::createProvisiongResourceACL(OicSecAcl_t *acl)\r
-        {\r
-            //TODO : Have to accept subject id of the mediator from application during easysetup\r
-            // initialization.\r
-            char temp_id[UUID_LENGTH+1] = {"admindeviceUUID0"};\r
-            for (int i = 0, j = 0; temp_id[i] != '\0'; i++)\r
-            {\r
-                acl->subject.id[j++] = temp_id[i];\r
-            }\r
-\r
-            //Always resource length is 1. /oic/prov is the only resource for which needs ACL\r
-            // permission has to be set\r
-            acl->resourcesLen = 1;\r
-            acl->resources = (char **) OICCalloc(acl->resourcesLen, sizeof(char *));\r
-            if (NULL == acl->resources)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while memory allocation");\r
-                return ES_ERROR;\r
-            }\r
-\r
-            char temp_rsc[MAX_URI_LENGTH] = {OC_RSRVD_ES_URI_PROV};\r
-\r
-            for (size_t i = 0; i < acl->resourcesLen; i++)\r
-            {\r
-                acl->resources[i] = OICStrdup(temp_rsc);\r
-                if (NULL == acl->resources[i])\r
-                {\r
-                    OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while memory allocation");\r
-                    return ES_ERROR;\r
-                }\r
-            }\r
-            // Set Permission\r
-            char temp_pms[MAX_PERMISSION_LENGTH+1]={"CRUDN"};\r
-            int ret;\r
-            do\r
-            {\r
-                ret = CalculateAclPermission(temp_pms, &(acl->permission));\r
-            } while (0 != ret);\r
-\r
-            //TODO : Have to accept subject id of the mediator from application during easysetup\r
-            // initialization.\r
-            for (int i = 0, j = 0; temp_id[i] != '\0'; i++)\r
-            {\r
-                acl->subject.id[j++] = temp_id[i];\r
-            }\r
-\r
-            // Set Rowner\r
-            acl->ownersLen = 1;//Always resource owner is only one, which is the mediator\r
-            acl->owners = (OicUuid_t *) OICCalloc(acl->ownersLen, sizeof(OicUuid_t));\r
-            if (NULL == acl->owners)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while memory allocation");\r
-                return ES_ERROR;\r
-            }\r
-            for (size_t i = 0; i < acl->ownersLen; i++)\r
-            {\r
-                for (int k = 0, j = 0; temp_id[k] != '\0'; k++)\r
-                {\r
-                    acl->owners[i].id[j++] = temp_id[k];\r
-                }\r
-            }\r
-            return ES_OK;\r
-        }\r
-\r
-        ESResult EnrolleeSecurity::provisionAcl()\r
-        {\r
-            // TODO : Currently device uuid is hardcoded, but this id has to be obtained from the\r
-            // application\r
-            OicSecAcl_t *acl = nullptr;\r
-\r
-            acl = (OicSecAcl_t *) OICCalloc(1, sizeof(OicSecAcl_t));\r
-            if (nullptr == acl)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Error while memory allocation");\r
-                return ES_ERROR;\r
-            }\r
-\r
-            if ( createProvisiongResourceACL (acl) == ES_ERROR)\r
-            {\r
-               return ES_ERROR;\r
-            }\r
-\r
-\r
-            OC::ResultCallBack provisioningCb = std::bind(&EnrolleeSecurity::provisionCb, this,\r
-            std::placeholders::_1, std::placeholders::_2);\r
-\r
-            if (m_unownedDevice->provisionACL(acl, provisioningCb) != OC_STACK_OK)\r
-            {\r
-                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "provisionACL is failed");\r
-                return ES_ERROR;\r
-            }\r
-            return ES_OK;\r
-        }\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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 "RemoteEnrolleeResource.h"
+#include "logger.h"
+#include "ESException.h"
+#include "oic_malloc.h"
+#include "oic_string.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< RemoteEnrolleeResource > remoteEnrolleeResource,
+        std::string secDbPath)
+        {
+            m_enrolleeSecState = EnrolleeSecState::ES_SEC_UNKNOWN;
+            m_remoteEnrolleeResource = remoteEnrolleeResource;
+
+            //Initializing the provisioning client stack using the db path provided by the
+            // application.
+            // Note : If the path is NULL or empty, the PDM.db should be present in the same path.
+            OCStackResult result = OCSecure::provisionInit(secDbPath);
+
+            if (result != OC_STACK_OK)
+            {
+                throw ESPlatformException(result);
+            }
+        }
+
+        ESResult EnrolleeSecurity::registerCallbackHandler(EnrolleeSecStatusCb enrolleeSecStatusCb,
+                SecurityPinCb securityPinCb, SecProvisioningDbPathCb secProvisioningDbPathCb)
+
+        {
+            m_enrolleeSecStatusCb = enrolleeSecStatusCb;
+            m_securityPinCb = securityPinCb;
+            m_secProvisioningDbPathCb = secProvisioningDbPathCb;
+
+            return ES_ERROR;
+        }
+
+        std::shared_ptr< OC::OCSecureResource > EnrolleeSecurity::findEnrollee(std::string host,
+                DeviceList_t &list)
+        {
+            for (unsigned int i = 0; i < list.size(); i++)
+            {
+                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Device %d ID %s ", i + 1,
+                        list[i]->getDeviceID().c_str());
+                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "From IP :%s", list[i]->getDevAddr().c_str());
+
+                if (list[i]->getDevAddr() == host)
+                {
+                    return list[i];
+                }
+            }
+
+            return nullptr;
+        }
+
+        void EnrolleeSecurity::convertUUIDToString(OicUuid_t uuid, std::string& uuidString)
+        {
+            char base64Buff[B64ENCODE_OUT_SAFESIZE(sizeof(((OicUuid_t*) 0)->id)) + 1] =
+            { 0, };
+            uint32_t outLen = 0;
+            B64Result b64Ret = B64_OK;
+            std::ostringstream deviceId("");
+
+            b64Ret = b64Encode(uuid.id, sizeof(uuid.id),
+                    base64Buff, sizeof(base64Buff), &outLen);
+
+            if (B64_OK == b64Ret)
+            {
+                deviceId << base64Buff;
+            }
+            uuidString =  deviceId.str();
+        }
+
+        void EnrolleeSecurity::ownershipTransferCb(OC::PMResultList_t *result, int hasError)
+        {
+            if (hasError)
+            {
+                OC_LOG(ERROR, ENROLEE_SECURITY_TAG,"Error!!! in OwnershipTransfer");
+
+                std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;
+                std::string uuid;
+                convertUUIDToString(result->at(0).deviceId, uuid);
+                securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,
+                        ES_ERROR);
+
+                m_enrolleeSecStatusCb(securityProvisioningStatus);
+                return;
+            }
+            else
+            {
+                OC_LOG(DEBUG, ENROLEE_SECURITY_TAG, "ownershipTransferCb : Received provisioning results: ");
+                for (unsigned int i = 0; i < result->size(); i++)
+                {
+                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Result is = %d for device",result->at(i).res);
+                    std::string uuid;
+                    convertUUIDToString(result->at(0).deviceId, uuid);
+
+                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "UUID : %s",uuid.c_str());
+                    std::shared_ptr< SecProvisioningResult > securityProvisioningStatus = nullptr;
+                    securityProvisioningStatus = std::make_shared< SecProvisioningResult >(uuid,
+                            ES_OK);
+
+                    m_enrolleeSecStatusCb(securityProvisioningStatus);
+                    return;
+                }
+
+                delete result;
+            }
+        }
+
+        EasySetupState EnrolleeSecurity::performOwnershipTransfer()
+        {
+            EasySetupState ownershipStatus = DEVICE_NOT_OWNED;
+
+            OC::DeviceList_t pUnownedDevList, pOwnedDevList;
+
+            pOwnedDevList.clear();
+            pUnownedDevList.clear();
+
+            OCStackResult result;
+
+            //Developer note : Always test the mediator and enrollee applications on different devices. Running
+            // Mediator and Enrollee in same device will result in returning the same device as already owned.
+            result = OCSecure::discoverOwnedDevices(ES_SEC_DISCOVERY_TIMEOUT,
+                    pOwnedDevList);
+            if (result != OC_STACK_OK)
+            {
+                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "Owned Discovery failed.");
+                ownershipStatus = DEVICE_NOT_OWNED;
+                //Throw exception
+                throw ESPlatformException(result);
+                return ownershipStatus;
+            }
+            else if (pOwnedDevList.size())
+            {
+                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found owned devices. Count =%d",
+                        pOwnedDevList.size());
+                std::shared_ptr< OC::OCSecureResource > ownedDevice =
+                        findEnrollee(
+                                std::string(
+                                        m_remoteEnrolleeResource->m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress),
+                                pOwnedDevList);
+                if (ownedDevice)
+                {
+                    ownershipStatus = DEVICE_OWNED;
+                    return ownershipStatus;
+                }
+            }
+            else
+            {
+                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No owned devices found.");
+                ownershipStatus = DEVICE_NOT_OWNED;
+            }
+
+            result = OCSecure::discoverUnownedDevices(ES_SEC_DISCOVERY_TIMEOUT, pUnownedDevList);
+            if (result != OC_STACK_OK)
+            {
+                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "UnOwned Discovery failed.");
+                ownershipStatus = DEVICE_NOT_OWNED;
+                //Throw exception
+                throw ESPlatformException(result);
+                return ownershipStatus;
+            }
+            else if (pUnownedDevList.size())
+            {
+                OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Found Unowned devices. Count =%d",
+                        pUnownedDevList.size());
+
+                m_unownedDevice =
+                        findEnrollee(
+                                m_remoteEnrolleeResource->m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress,
+                                pUnownedDevList);
+                if (m_unownedDevice)
+                {
+                    OTMCallbackData_t justWorksCBData;
+                    justWorksCBData.loadSecretCB = LoadSecretJustWorksCallback;
+                    justWorksCBData.createSecureSessionCB = CreateSecureSessionJustWorksCallback;
+                    justWorksCBData.createSelectOxmPayloadCB = CreateJustWorksSelectOxmPayload;
+                    justWorksCBData.createOwnerTransferPayloadCB =
+                            CreateJustWorksOwnerTransferPayload;
+                    OCSecure::setOwnerTransferCallbackData(OIC_JUST_WORKS, &justWorksCBData, NULL);
+
+                    OC_LOG_V(DEBUG, ENROLEE_SECURITY_TAG, "Transfering ownership for : %s ",
+                            m_unownedDevice->getDeviceID().c_str());
+
+                    OC::ResultCallBack ownershipTransferCb = std::bind(
+                            &EnrolleeSecurity::ownershipTransferCb, this, std::placeholders::_1,
+                            std::placeholders::_2);
+
+                    if (m_unownedDevice->doOwnershipTransfer(ownershipTransferCb) != OC_STACK_OK)
+                    {
+                        OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "OwnershipTransferCallback is failed");
+                        ownershipStatus = DEVICE_NOT_OWNED;
+                        //Throw exception
+                        throw ESPlatformException(result);
+                    }
+                    ownershipStatus = DEVICE_NOT_OWNED;
+                }
+            }
+            else
+            {
+                OC_LOG(ERROR, ENROLEE_SECURITY_TAG, "No unSecure devices found.");
+                ownershipStatus = DEVICE_NOT_OWNED;
+
+                return ownershipStatus;
+            }
+
+            return ownershipStatus;
+        }
+    }
+}
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#include "RemoteEnrollee.h"\r
-#include "RemoteEnrolleeResource.h"\r
-#include "ESException.h"\r
-#include "logger.h"\r
-#ifdef __WITH_DTLS__\r
-#include "EnrolleeSecurity.h"\r
-#endif //__WITH_DTLS\r
-\r
-namespace OIC\r
-{\r
-    #define ES_REMOTE_ENROLLEE_TAG "ES_REMOTE_ENROLLEE"\r
-\r
-    namespace Service\r
-    {\r
-        RemoteEnrollee::RemoteEnrollee(const EnrolleeNWProvInfo& enrolleeNWProvInfo) :\r
-                m_enrolleeNWProvInfo(enrolleeNWProvInfo)\r
-        {\r
-            m_currentESState = CurrentESState::ES_UNKNOWN;\r
-            m_needSecuredEasysetup = enrolleeNWProvInfo.needSecuredEasysetup;\r
-\r
-            OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Inside RemoteEnrollee constr");\r
-        }\r
-\r
-#ifdef __WITH_DTLS__\r
-        ESResult RemoteEnrollee::registerSecurityCallbackHandler(SecurityPinCb securityPinCb,\r
-                SecProvisioningDbPathCb secProvisioningDbPathCb)\r
-        {\r
-            // No need to check NULL for m_secProvisioningDbPathCB as this is not a mandatory\r
-            // callback function. If m_secProvisioningDbPathCB is NULL, provisioning manager\r
-            // in security layer will try to find the PDM.db file in the local path.\r
-            // If PDM.db is found, the provisioning manager operations will succeed.\r
-            // Otherwise all the provisioning manager operations will fail.\r
-            m_secProvisioningDbPathCb = secProvisioningDbPathCb;\r
-            m_securityPinCb = securityPinCb;\r
-            return ES_OK;\r
-        }\r
-#endif //__WITH_DTLS__\r
-\r
-        void RemoteEnrollee::registerEasySetupStatusHandler(EasySetupStatusCB callback)\r
-        {\r
-            OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Entered registerStatusHandler");\r
-            if(!callback)\r
-            {\r
-                throw ESInvalidParameterException("Callback is empty");\r
-            }\r
-\r
-            if (m_easySetupStatusCb)\r
-            {\r
-                throw ESBadRequestException("Callback handler already registered");\r
-            }\r
-            else\r
-            {\r
-                m_easySetupStatusCb = callback;\r
-\r
-                m_remoteResource = std::make_shared< RemoteEnrolleeResource >(m_enrolleeNWProvInfo);\r
-            }\r
-        }\r
-\r
-        void RemoteEnrollee::easySetupSecurityStatusCallback(\r
-                        std::shared_ptr< SecProvisioningResult > secProvisioningResult)\r
-        {\r
-            OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "easySetupStatusCallback status is, UUID = %s, "\r
-                    "Status = %d", secProvisioningResult->getDeviceUUID().c_str(),\r
-                    secProvisioningResult->getResult());\r
-\r
-            if(secProvisioningResult->getResult() == ES_OK)\r
-            {\r
-                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful. "\r
-                        "Continue with Network information provisioning");\r
-\r
-                m_currentESState = CurrentESState::ES_OWNED;\r
-\r
-                OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");\r
-\r
-                RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(\r
-                        &RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);\r
-\r
-                m_remoteResource->registerProvStatusCallback(provStatusCb);\r
-                m_remoteResource->provisionEnrollee();\r
-            }\r
-            else\r
-            {\r
-                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful");\r
-                std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;\r
-                easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,\r
-                                            m_enrolleeNWProvInfo);\r
-                if (m_easySetupStatusCb)\r
-                {\r
-                    if (easySetupStatus)\r
-                    {\r
-                        m_easySetupStatusCb(easySetupStatus);\r
-                    }\r
-                    else\r
-                    {\r
-                        m_easySetupStatusCb(nullptr);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-\r
-        void RemoteEnrollee::provisioningStatusHandler(\r
-                std::shared_ptr< ProvisioningStatus > provStatus)\r
-        {\r
-            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering ProvisioningStatusHandler");\r
-\r
-            OC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"ProvStatus = %d", provStatus->getESResult());\r
-\r
-            std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;\r
-\r
-            if (m_enrolleeNWProvInfo.isSecured)\r
-            {\r
-                if (m_currentESState > CurrentESState::ES_OWNED)\r
-                {\r
-                    goto CALLBACK_CHECK;\r
-                }\r
-                else\r
-                {\r
-                    goto FAILURE;\r
-                }\r
-            }\r
-            else\r
-            {\r
-                goto CALLBACK_CHECK;\r
-            }\r
-\r
-            CALLBACK_CHECK:\r
-\r
-            if (provStatus->getESResult() == ES_OK)\r
-            {\r
-                if (provStatus->getESState() >= ESState::ES_PROVISIONED_ALREADY)\r
-                {\r
-                    easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_PROVISIONED,\r
-                            m_enrolleeNWProvInfo);\r
-                }\r
-                else\r
-                {\r
-                    easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,\r
-                            m_enrolleeNWProvInfo);\r
-                }\r
-            }\r
-            else\r
-            {\r
-                easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,\r
-                        m_enrolleeNWProvInfo);\r
-            }\r
-\r
-            if (m_easySetupStatusCb)\r
-            {\r
-                if (easySetupStatus)\r
-                {\r
-                    m_easySetupStatusCb(easySetupStatus);\r
-                }\r
-                else\r
-                {\r
-                    m_easySetupStatusCb(nullptr);\r
-                }\r
-            }\r
-\r
-            return;\r
-\r
-            FAILURE:\r
-\r
-            easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,\r
-                                    m_enrolleeNWProvInfo);\r
-\r
-            if (easySetupStatus)\r
-            {\r
-                m_easySetupStatusCb(easySetupStatus);\r
-            }\r
-            else\r
-            {\r
-                m_easySetupStatusCb(nullptr);\r
-            }\r
-            return;\r
-        }\r
-\r
-        void RemoteEnrollee::startProvisioning()\r
-        {\r
-            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering startProvisioning");\r
-            if (m_remoteResource == nullptr)\r
-            {\r
-                throw ESBadRequestException ("Device not created");\r
-            }\r
-\r
-            ESResult result = ES_ERROR;\r
-\r
-            result = m_remoteResource->constructResourceObject();\r
-\r
-            if (result == ES_ERROR)\r
-            {\r
-                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,\r
-                                    "Failed to create device using constructResourceObject");\r
-                throw ESBadRequestException ("Device not created");\r
-            }\r
-\r
-            m_currentESState = CurrentESState::ES_ONBOARDED;\r
-\r
-#ifdef __WITH_DTLS__\r
-            if (m_needSecuredEasysetup && m_currentESState < CurrentESState::ES_OWNED)\r
-            {\r
-                EnrolleeSecStatusCb securityProvStatusCb = std::bind(\r
-                        &RemoteEnrollee::easySetupSecurityStatusCallback,\r
-                        this,\r
-                        std::placeholders::_1);\r
-                //TODO : DBPath is passed empty as of now. Need to take dbpath from application.\r
-                m_enrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_remoteResource, "");\r
-\r
-                m_enrolleeSecurity->registerCallbackHandler(securityProvStatusCb,\r
-                        m_securityPinCb, m_secProvisioningDbPathCb);\r
-\r
-                try\r
-                {\r
-                    EasySetupState easySetupState = m_enrolleeSecurity->performOwnershipTransfer();\r
-                    if (easySetupState == DEVICE_NOT_OWNED)\r
-                    {\r
-                        OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,\r
-                                "performOwnershipTransfer returned : %d",\r
-                                easySetupState);\r
-                        return;\r
-                    }\r
-                    else if (easySetupState == DEVICE_OWNED)\r
-                    {\r
-                        OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,\r
-                                "performOwnershipTransfer returned : %d",\r
-                                easySetupState);\r
-                        OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");\r
-\r
-                        RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(\r
-                                &RemoteEnrollee::provisioningStatusHandler,\r
-                                this, std::placeholders::_1);\r
-\r
-                        m_remoteResource->registerProvStatusCallback(provStatusCb);\r
-                        m_remoteResource->provisionEnrollee();\r
-                    }\r
-                }\r
-                catch (OCException & e)\r
-                {\r
-                    OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_TAG,\r
-                            "Exception for performOwnershipTransfer : %s", e.reason().c_str());\r
-                    return ;\r
-                }\r
-            }\r
-#else\r
-            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");\r
-\r
-            RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(\r
-                    &RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);\r
-\r
-            m_remoteResource->registerProvStatusCallback(provStatusCb);\r
-            m_remoteResource->provisionEnrollee();\r
-#endif\r
-        }\r
-\r
-        void RemoteEnrollee::stopProvisioning()\r
-        {\r
-            m_currentESState = CurrentESState::ES_UNKNOWN;\r
-\r
-            m_remoteResource->unprovisionEnrollee();\r
-        }\r
-\r
-        bool RemoteEnrollee::isEnrolleeProvisioned()\r
-        {\r
-            if(m_currentESState >= CurrentESState::ES_PROVISIONED)\r
-            {\r
-                return true;\r
-            }\r
-            else\r
-            {\r
-                return false;\r
-            }\r
-        }\r
-\r
-        EnrolleeNWProvInfo& RemoteEnrollee::getEnrolleeProvisioningInfo ()\r
-        {\r
-            return m_enrolleeNWProvInfo;\r
-        }\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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 "RemoteEnrolleeResource.h"
+#include "ESException.h"
+#include "logger.h"
+#ifdef __WITH_DTLS__
+#include "EnrolleeSecurity.h"
+#endif //__WITH_DTLS
+
+namespace OIC
+{
+    #define ES_REMOTE_ENROLLEE_TAG "ES_REMOTE_ENROLLEE"
+
+    namespace Service
+    {
+        RemoteEnrollee::RemoteEnrollee(const EnrolleeNWProvInfo& enrolleeNWProvInfo) :
+                m_enrolleeNWProvInfo(enrolleeNWProvInfo)
+        {
+            m_currentESState = CurrentESState::ES_UNKNOWN;
+            m_needSecuredEasysetup = enrolleeNWProvInfo.needSecuredEasysetup;
+
+            OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Inside RemoteEnrollee constr");
+        }
+
+#ifdef __WITH_DTLS__
+        ESResult RemoteEnrollee::registerSecurityCallbackHandler(SecurityPinCb securityPinCb,
+                SecProvisioningDbPathCb secProvisioningDbPathCb)
+        {
+            // No need to check NULL for m_secProvisioningDbPathCB as this is not a mandatory
+            // callback function. If m_secProvisioningDbPathCB is NULL, provisioning manager
+            // in security layer will try to find the PDM.db file in the local path.
+            // If PDM.db is found, the provisioning manager operations will succeed.
+            // Otherwise all the provisioning manager operations will fail.
+            m_secProvisioningDbPathCb = secProvisioningDbPathCb;
+            m_securityPinCb = securityPinCb;
+            return ES_OK;
+        }
+#endif //__WITH_DTLS__
+
+        void RemoteEnrollee::registerEasySetupStatusHandler(EasySetupStatusCB callback)
+        {
+            OC_LOG ( DEBUG, ES_REMOTE_ENROLLEE_TAG, "Entered registerStatusHandler");
+            if(!callback)
+            {
+                throw ESInvalidParameterException("Callback is empty");
+            }
+
+            if (m_easySetupStatusCb)
+            {
+                throw ESBadRequestException("Callback handler already registered");
+            }
+            else
+            {
+                m_easySetupStatusCb = callback;
+
+                m_remoteResource = std::make_shared< RemoteEnrolleeResource >(m_enrolleeNWProvInfo);
+            }
+        }
+
+        void RemoteEnrollee::easySetupSecurityStatusCallback(
+                        std::shared_ptr< SecProvisioningResult > secProvisioningResult)
+        {
+            OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "easySetupStatusCallback status is, UUID = %s, "
+                    "Status = %d", secProvisioningResult->getDeviceUUID().c_str(),
+                    secProvisioningResult->getResult());
+
+            if(secProvisioningResult->getResult() == ES_OK)
+            {
+                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful. "
+                        "Continue with Network information provisioning");
+
+                m_currentESState = CurrentESState::ES_OWNED;
+
+                OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+
+                RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
+                        &RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);
+
+                m_remoteResource->registerProvStatusCallback(provStatusCb);
+                m_remoteResource->provisionEnrollee();
+            }
+            else
+            {
+                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "Ownership and ACL are successful");
+                std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;
+                easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,
+                                            m_enrolleeNWProvInfo);
+                if (m_easySetupStatusCb)
+                {
+                    if (easySetupStatus)
+                    {
+                        m_easySetupStatusCb(easySetupStatus);
+                    }
+                    else
+                    {
+                        m_easySetupStatusCb(nullptr);
+                    }
+                }
+            }
+        }
+
+        void RemoteEnrollee::provisioningStatusHandler(
+                std::shared_ptr< ProvisioningStatus > provStatus)
+        {
+            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering ProvisioningStatusHandler");
+
+            OC_LOG_V(DEBUG,ES_REMOTE_ENROLLEE_TAG,"ProvStatus = %d", provStatus->getESResult());
+
+            std::shared_ptr< EasySetupStatus > easySetupStatus = nullptr;
+
+            if (m_enrolleeNWProvInfo.isSecured)
+            {
+                if (m_currentESState > CurrentESState::ES_OWNED)
+                {
+                    goto CALLBACK_CHECK;
+                }
+                else
+                {
+                    goto FAILURE;
+                }
+            }
+            else
+            {
+                goto CALLBACK_CHECK;
+            }
+
+            CALLBACK_CHECK:
+
+            if (provStatus->getESResult() == ES_OK)
+            {
+                if (provStatus->getESState() >= ESState::ES_PROVISIONED_ALREADY)
+                {
+                    easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_PROVISIONED,
+                            m_enrolleeNWProvInfo);
+                }
+                else
+                {
+                    easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,
+                            m_enrolleeNWProvInfo);
+                }
+            }
+            else
+            {
+                easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,
+                        m_enrolleeNWProvInfo);
+            }
+
+            if (m_easySetupStatusCb)
+            {
+                if (easySetupStatus)
+                {
+                    m_easySetupStatusCb(easySetupStatus);
+                }
+                else
+                {
+                    m_easySetupStatusCb(nullptr);
+                }
+            }
+
+            return;
+
+            FAILURE:
+
+            easySetupStatus = std::make_shared< EasySetupStatus >(DEVICE_NOT_PROVISIONED,
+                                    m_enrolleeNWProvInfo);
+
+            if (easySetupStatus)
+            {
+                m_easySetupStatusCb(easySetupStatus);
+            }
+            else
+            {
+                m_easySetupStatusCb(nullptr);
+            }
+            return;
+        }
+
+        void RemoteEnrollee::startProvisioning()
+        {
+            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Entering startProvisioning");
+            if (m_remoteResource == nullptr)
+            {
+                throw ESBadRequestException ("Device not created");
+            }
+
+            ESResult result = ES_ERROR;
+
+            result = m_remoteResource->constructResourceObject();
+
+            if (result == ES_ERROR)
+            {
+                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_TAG,
+                                    "Failed to create device using constructResourceObject");
+                throw ESBadRequestException ("Device not created");
+            }
+
+            m_currentESState = CurrentESState::ES_ONBOARDED;
+
+#ifdef __WITH_DTLS__
+            if (m_needSecuredEasysetup && m_currentESState < CurrentESState::ES_OWNED)
+            {
+                EnrolleeSecStatusCb securityProvStatusCb = std::bind(
+                        &RemoteEnrollee::easySetupSecurityStatusCallback,
+                        this,
+                        std::placeholders::_1);
+                //TODO : DBPath is passed empty as of now. Need to take dbpath from application.
+                m_enrolleeSecurity = std::make_shared <EnrolleeSecurity> (m_remoteResource, "");
+
+                m_enrolleeSecurity->registerCallbackHandler(securityProvStatusCb,
+                        m_securityPinCb, m_secProvisioningDbPathCb);
+
+                try
+                {
+                    EasySetupState easySetupState = m_enrolleeSecurity->performOwnershipTransfer();
+                    if (easySetupState == DEVICE_NOT_OWNED)
+                    {
+                        OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
+                                "performOwnershipTransfer returned : %d",
+                                easySetupState);
+                        return;
+                    }
+                    else if (easySetupState == DEVICE_OWNED)
+                    {
+                        OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG,
+                                "performOwnershipTransfer returned : %d",
+                                easySetupState);
+                        OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+
+                        RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
+                                &RemoteEnrollee::provisioningStatusHandler,
+                                this, std::placeholders::_1);
+
+                        m_remoteResource->registerProvStatusCallback(provStatusCb);
+                        m_remoteResource->provisionEnrollee();
+                    }
+                }
+                catch (OCException & e)
+                {
+                    OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_TAG,
+                            "Exception for performOwnershipTransfer : %s", e.reason().c_str());
+                    return ;
+                }
+            }
+#else
+            OC_LOG(DEBUG,ES_REMOTE_ENROLLEE_TAG,"Before ProvisionEnrollee");
+
+            RemoteEnrolleeResource::ProvStatusCb provStatusCb = std::bind(
+                    &RemoteEnrollee::provisioningStatusHandler, this, std::placeholders::_1);
+
+            m_remoteResource->registerProvStatusCallback(provStatusCb);
+            m_remoteResource->provisionEnrollee();
+#endif
+        }
+
+        void RemoteEnrollee::stopProvisioning()
+        {
+            m_currentESState = CurrentESState::ES_UNKNOWN;
+
+            m_remoteResource->unprovisionEnrollee();
+        }
+
+        bool RemoteEnrollee::isEnrolleeProvisioned()
+        {
+            if(m_currentESState >= CurrentESState::ES_PROVISIONED)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        EnrolleeNWProvInfo& RemoteEnrollee::getEnrolleeProvisioningInfo ()
+        {
+            return m_enrolleeNWProvInfo;
+        }
+    }
+}
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-#include <functional>\r
-#include <time.h>\r
-\r
-#include "RemoteEnrolleeResource.h"\r
-\r
-#include "OCPlatform.h"\r
-#include "ESException.h"\r
-#include "OCResource.h"\r
-#include "logger.h"\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        #define ES_REMOTE_ENROLLEE_RES_TAG "ES_REMOTE_ENROLLEE_RES"\r
-        #define DISCOVERY_TIMEOUT 5\r
-\r
-        static const char ES_BASE_RES_URI[] = "/oic/res";\r
-        static const char ES_PROV_RES_URI[] = "/oic/prov";\r
-        static const char ES_PROV_RES_TYPE[] = "oic.r.prov";\r
-\r
-        RemoteEnrolleeResource::RemoteEnrolleeResource(EnrolleeNWProvInfo enrolleeNWProvInfo)\r
-        {\r
-            m_enrolleeNWProvInfo = enrolleeNWProvInfo;\r
-            m_discoveryResponse = false;\r
-        }\r
-\r
-        void RemoteEnrolleeResource::checkProvInformationCb(const HeaderOptions& /*headerOptions*/,\r
-                const OCRepresentation& rep, const int eCode)\r
-        {\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",\r
-                    rep.getUri().c_str(),\r
-                    eCode);\r
-\r
-            if (eCode != 0)\r
-            {\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "checkProvInformationCb : Provisioning is failed ");\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);\r
-                m_provStatusCb(provStatus);\r
-                return;\r
-            }\r
-\r
-            int ps = -1;\r
-            std::string tnn = "";\r
-            std::string cd = "";\r
-\r
-            rep.getValue(OC_RSRVD_ES_PS, ps);\r
-            rep.getValue(OC_RSRVD_ES_TNN, tnn);\r
-            rep.getValue(OC_RSRVD_ES_CD, cd);\r
-\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : ps - %d", ps);\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                    "checkProvInformationCb : tnn - %s", tnn.c_str());\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                    "checkProvInformationCb : cd - %s", cd.c_str());\r
-\r
-            //Provisioning status check\r
-            if (ps == ES_PS_PROVISIONING_COMPLETED)\r
-            {\r
-                if (tnn != std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid))\r
-                {\r
-                    OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                            "checkProvInformationCb : Network SSID is not the same as the "\r
-                            "SSID provisioned");\r
-                    std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                            ProvisioningStatus >(ESResult::ES_ERROR,\r
-                            ESState::ES_PROVISIONING_ERROR);\r
-                    m_provStatusCb(provStatus);\r
-                    return;\r
-                }\r
-\r
-                if (cd != std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd))\r
-                {\r
-                    OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                            "checkProvInformationCb : Network PWD is not the same as the "\r
-                            "PWD provisioned");\r
-                    std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                            ProvisioningStatus >(ESResult::ES_ERROR,\r
-                            ESState::ES_PROVISIONING_ERROR);\r
-                    m_provStatusCb(provStatus);\r
-                    return;\r
-                }\r
-\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "checkProvInformationCb : Provisioning is success ");\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONING_SUCCESS);\r
-                m_provStatusCb(provStatus);\r
-                return;\r
-            }\r
-            else\r
-            {\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "checkProvInformationCb : Provisioning is failed ");\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);\r
-                m_provStatusCb(provStatus);\r
-                return;\r
-            }\r
-        }\r
-\r
-        void RemoteEnrolleeResource::getProvStatusResponse(const HeaderOptions& /*headerOptions*/,\r
-                const OCRepresentation& rep, const int eCode)\r
-        {\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : %s, eCode = %d",\r
-                    rep.getUri().c_str(),\r
-                    eCode);\r
-\r
-            if (eCode != 0)\r
-            {\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "getProvStatusResponse : Provisioning is failed ");\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);\r
-                m_provStatusCb(provStatus);\r
-                return;\r
-            }\r
-\r
-            int ps = -1;\r
-            std::string tnn = "";\r
-            std::string cd = "";\r
-\r
-            rep.getValue(OC_RSRVD_ES_PS, ps);\r
-            rep.getValue(OC_RSRVD_ES_TNN, tnn);\r
-            rep.getValue(OC_RSRVD_ES_CD, cd);\r
-\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ps - %d",\r
-                    ps);\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : tnn - %s",\r
-                    tnn.c_str());\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : cd - %s",\r
-                    cd.c_str());\r
-\r
-            if (ps == ES_PS_NEED_PROVISIONING) //Indicates the need for provisioning\r
-            {\r
-                OCRepresentation provisioningRepresentation;\r
-\r
-                provisioningRepresentation.setValue(OC_RSRVD_ES_TNN,\r
-                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid));\r
-                provisioningRepresentation.setValue(OC_RSRVD_ES_CD,\r
-                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd));\r
-\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ssid - %s",\r
-                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid);\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : pwd - %s",\r
-                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd);\r
-\r
-                m_ocResource->put(provisioningRepresentation, QueryParamsMap(),\r
-                        std::function<\r
-                                void(const HeaderOptions& headerOptions,\r
-                                        const OCRepresentation& rep, const int eCode) >(\r
-                        std::bind(&RemoteEnrolleeResource::checkProvInformationCb, this,\r
-                        std::placeholders::_1, std::placeholders::_2,\r
-                        std::placeholders::_3)));\r
-            }\r
-            else if (ps == ES_PS_PROVISIONING_COMPLETED) //Indicates that provisioning is completed\r
-            {\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "getProvStatusResponse : Provisioning is successful");\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONED_ALREADY);\r
-                m_provStatusCb(provStatus);\r
-            }\r
-        }\r
-\r
-        void RemoteEnrolleeResource::registerProvStatusCallback(ProvStatusCb provStatusCb)\r
-        {\r
-            m_provStatusCb = provStatusCb;\r
-        }\r
-\r
-        ESResult RemoteEnrolleeResource::ESDiscoveryTimeout(unsigned short waittime)\r
-        {\r
-            struct timespec startTime;\r
-            startTime.tv_sec=0;\r
-            startTime.tv_sec=0;\r
-            struct timespec currTime;\r
-            currTime.tv_sec=0;\r
-            currTime.tv_nsec=0;\r
-\r
-            ESResult res = ES_OK;\r
-            #ifdef _POSIX_MONOTONIC_CLOCK\r
-                int clock_res = clock_gettime(CLOCK_MONOTONIC, &startTime);\r
-            #else\r
-                int clock_res = clock_gettime(CLOCK_REALTIME, &startTime);\r
-            #endif\r
-\r
-            if (0 != clock_res)\r
-            {\r
-                return ES_ERROR;\r
-            }\r
-\r
-            while (ES_OK == res || m_discoveryResponse == false)\r
-            {\r
-                #ifdef _POSIX_MONOTONIC_CLOCK\r
-                        clock_res = clock_gettime(CLOCK_MONOTONIC, &currTime);\r
-                #else\r
-                        clock_res = clock_gettime(CLOCK_REALTIME, &currTime);\r
-                #endif\r
-\r
-                if (0 != clock_res)\r
-                {\r
-                    return ES_ERROR;\r
-                }\r
-                long elapsed = (currTime.tv_sec - startTime.tv_sec);\r
-                if (elapsed > waittime)\r
-                {\r
-                    return ES_OK;\r
-                }\r
-                if (m_discoveryResponse)\r
-                {\r
-                    res = ES_OK;\r
-                }\r
-             }\r
-             return res;\r
-        }\r
-\r
-        void RemoteEnrolleeResource::onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource)\r
-        {\r
-            OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onDeviceDiscovered");\r
-\r
-            std::string resourceURI;\r
-            std::string hostAddress;\r
-            try\r
-            {\r
-                if(resource)\r
-                {\r
-                    // Get the resource URI\r
-                    resourceURI = resource->uri();\r
-                    OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                            "URI of the resource: %s", resourceURI.c_str());\r
-\r
-                    // Get the resource host address\r
-                    hostAddress = resource->host();\r
-                    OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                            "Host address of the resource: %s", hostAddress.c_str());\r
-\r
-                    std::size_t foundIP =\r
-                        hostAddress.find(\r
-                                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress));\r
-\r
-                    if(resourceURI == ES_PROV_RES_URI && foundIP!=std::string::npos)\r
-                    {\r
-                        m_ocResource = resource;\r
-                        m_discoveryResponse = true;\r
-\r
-                        OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                                "Found the device with the resource");\r
-\r
-                        return;\r
-                    }\r
-                    else\r
-                    {\r
-                        OC_LOG (ERROR, ES_REMOTE_ENROLLEE_RES_TAG, "NOT the intended resource.");\r
-                    }\r
-                }\r
-                else\r
-                {\r
-                    OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Resource is invalid");\r
-                }\r
-\r
-            }\r
-            catch(std::exception& e)\r
-            {\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "Exception in foundResource: %s", e.what());\r
-            }\r
-        }\r
-\r
-\r
-        ESResult RemoteEnrolleeResource::constructResourceObject()\r
-        {\r
-            if (m_ocResource != nullptr)\r
-            {\r
-                throw ESBadRequestException("Remote resource is already created");\r
-            }\r
-\r
-#ifdef REMOTE_ARDUINO_ENROLEE\r
-            //This process will create OCResource with port 55555 which is specific\r
-            // to Arduino WiFi enrollee\r
-            try\r
-            {\r
-\r
-                std::vector< std::string > interface =\r
-                {   DEFAULT_INTERFACE};\r
-                std::vector< std::string > resTypes =\r
-                {   ES_PROV_RES_TYPE};\r
-\r
-                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");\r
-\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_host = %s",\r
-                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "ES_PROV_RES_URI = %s", ES_PROV_RES_URI);\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",\r
-                        m_enrolleeNWProvInfo.connType);\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "resTypes = %s",\r
-                        resTypes.at(0).c_str());\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "interface = %s", interface.at(0).c_str());\r
-\r
-                std::string host;\r
-                if(m_enrolleeNWProvInfo.needSecuredEasysetup)\r
-                {\r
-                    host.append("coaps://");\r
-                }\r
-                else\r
-                {\r
-                    host.append("coap://");\r
-                }\r
-\r
-                if(m_enrolleeNWProvInfo.connType == CT_ADAPTER_IP)\r
-                {\r
-                    // TODO : RemoteEnrollee is current handling easysetup on IP transport.\r
-                    // WiFiRemoteEnrollee need to extend RemoteEnrollee for providing IP specific\r
-                    // Enrollee easysetup.\r
-\r
-                    host.append(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);\r
-                    //TODO : If the target Enrollee is not a Arduino Wi-Fi device,\r
-                    // then the port number will be found during resource discovery instead of\r
-                    // using 55555\r
-                    host.append(":55555");\r
-                }\r
-\r
-                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "HOST = %s", host.c_str());\r
-\r
-                m_ocResource = OC::OCPlatform::constructResourceObject(host,\r
-                        ES_PROV_RES_URI,\r
-                        m_enrolleeNWProvInfo.connType,\r
-                        true,\r
-                        resTypes,\r
-                        interface);\r
-                OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "created OCResource : %s", m_ocResource->uri().c_str());\r
-\r
-                return ES_OK;\r
-            }\r
-            catch (OCException & e)\r
-            {\r
-                OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "Exception for constructResourceObject : %s", e.reason().c_str());\r
-            }\r
-\r
-#else\r
-            std::string host("");\r
-            std::string query("");\r
-\r
-            if (m_enrolleeNWProvInfo.needSecuredEasysetup)\r
-            {\r
-                host.append("coaps://");\r
-            }\r
-            else\r
-            {\r
-                host.append("coap://");\r
-            }\r
-\r
-            if (m_enrolleeNWProvInfo.connType == CT_ADAPTER_IP)\r
-            {\r
-                // TODO : RemoteEnrollee is current handling easysetup on IP transport.\r
-                // WiFiRemoteEnrollee need to extend RemoteEnrollee for providing IP specific\r
-                // Enrollee easysetup.\r
-\r
-                host.append(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);\r
-            }\r
-\r
-            query.append(ES_BASE_RES_URI);\r
-            query.append("?rt=");\r
-            query.append(ES_PROV_RES_TYPE);\r
-\r
-            OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");\r
-\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "host = %s",\r
-                    host.c_str());\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "query = %s", query.c_str());\r
-            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",\r
-                    m_enrolleeNWProvInfo.connType);\r
-\r
-            m_discoveryResponse = false;\r
-            std::function< void (std::shared_ptr<OC::OCResource>) > onDeviceDiscoveredCb =\r
-                    std::bind(&RemoteEnrolleeResource::onDeviceDiscovered, this,\r
-                                                    std::placeholders::_1);\r
-            OCStackResult result = OC::OCPlatform::findResource("", query, CT_DEFAULT,\r
-                    onDeviceDiscoveredCb);\r
-\r
-            if (result != OCStackResult::OC_STACK_OK)\r
-            {\r
-                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "Failed to create device using constructResourceObject");\r
-                return ES_ERROR;\r
-            }\r
-\r
-\r
-            ESResult foundResponse = ESDiscoveryTimeout (DISCOVERY_TIMEOUT);\r
-\r
-            if (!m_discoveryResponse)\r
-            {\r
-                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,\r
-                        "Failed to create device using constructResourceObject");\r
-                return ES_ERROR;\r
-            }\r
-\r
-            return ES_OK;\r
-#endif\r
-        }\r
-\r
-        void RemoteEnrolleeResource::provisionEnrollee()\r
-\r
-        {\r
-            if (m_ocResource == nullptr)\r
-            {\r
-                throw ESBadRequestException("Resource is not initialized");\r
-            }\r
-\r
-            OC::QueryParamsMap query;\r
-            OC::OCRepresentation rep;\r
-\r
-            std::function< OCStackResult(void) > getProvisioingStatus = [&]\r
-            {   return m_ocResource->get(m_ocResource->getResourceTypes().at(0),\r
-                        m_ocResource->getResourceInterfaces().at(0), query,\r
-                        std::function<\r
-                        void(const HeaderOptions& headerOptions, const OCRepresentation& rep,\r
-                                const int eCode) >(\r
-                                std::bind(&RemoteEnrolleeResource::getProvStatusResponse, this,\r
-                                        std::placeholders::_1, std::placeholders::_2,\r
-                                        std::placeholders::_3)));\r
-            };\r
-\r
-            OCStackResult result = getProvisioingStatus();\r
-\r
-            if (result != OCStackResult::OC_STACK_OK)\r
-            {\r
-                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<\r
-                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);\r
-                m_provStatusCb(provStatus);\r
-                return;\r
-            }\r
-        }\r
-\r
-        void RemoteEnrolleeResource::unprovisionEnrollee()\r
-        {\r
-            if (m_ocResource == nullptr)\r
-            {\r
-                throw ESBadRequestException("Resource is not initialized");\r
-            }\r
-\r
-            OCRepresentation provisioningRepresentation;\r
-\r
-            provisioningRepresentation.setValue(OC_RSRVD_ES_TNN, "");\r
-            provisioningRepresentation.setValue(OC_RSRVD_ES_CD, "");\r
-\r
-            m_ocResource->post(provisioningRepresentation, QueryParamsMap(),\r
-                    std::function<\r
-                            void(const HeaderOptions& headerOptions, const OCRepresentation& rep,\r
-                                    const int eCode) >(\r
-                    std::bind(&RemoteEnrolleeResource::checkProvInformationCb, this,\r
-                    std::placeholders::_1, std::placeholders::_2,\r
-                    std::placeholders::_3)));\r
-        }\r
-    }\r
-}\r
+//******************************************************************
+//
+// 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 <time.h>
+
+#include "RemoteEnrolleeResource.h"
+
+#include "OCPlatform.h"
+#include "ESException.h"
+#include "OCResource.h"
+#include "logger.h"
+
+namespace OIC
+{
+    namespace Service
+    {
+        #define ES_REMOTE_ENROLLEE_RES_TAG "ES_REMOTE_ENROLLEE_RES"
+        #define DISCOVERY_TIMEOUT 5
+
+        static const char ES_BASE_RES_URI[] = "/oic/res";
+        static const char ES_PROV_RES_URI[] = "/oic/prov";
+        static const char ES_PROV_RES_TYPE[] = "oic.r.prov";
+
+        RemoteEnrolleeResource::RemoteEnrolleeResource(EnrolleeNWProvInfo enrolleeNWProvInfo)
+        {
+            m_enrolleeNWProvInfo = enrolleeNWProvInfo;
+            m_discoveryResponse = false;
+        }
+
+        void RemoteEnrolleeResource::checkProvInformationCb(const HeaderOptions& /*headerOptions*/,
+                const OCRepresentation& rep, const int eCode)
+        {
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : %s, eCode = %d",
+                    rep.getUri().c_str(),
+                    eCode);
+
+            if (eCode != 0)
+            {
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "checkProvInformationCb : Provisioning is failed ");
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
+                m_provStatusCb(provStatus);
+                return;
+            }
+
+            int ps = -1;
+            std::string tnn = "";
+            std::string cd = "";
+
+            rep.getValue(OC_RSRVD_ES_PS, ps);
+            rep.getValue(OC_RSRVD_ES_TNN, tnn);
+            rep.getValue(OC_RSRVD_ES_CD, cd);
+
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "checkProvInformationCb : ps - %d", ps);
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                    "checkProvInformationCb : tnn - %s", tnn.c_str());
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                    "checkProvInformationCb : cd - %s", cd.c_str());
+
+            //Provisioning status check
+            if (ps == ES_PS_PROVISIONING_COMPLETED)
+            {
+                if (tnn != std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid))
+                {
+                    OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+                            "checkProvInformationCb : Network SSID is not the same as the "
+                            "SSID provisioned");
+                    std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                            ProvisioningStatus >(ESResult::ES_ERROR,
+                            ESState::ES_PROVISIONING_ERROR);
+                    m_provStatusCb(provStatus);
+                    return;
+                }
+
+                if (cd != std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd))
+                {
+                    OC_LOG_V (ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+                            "checkProvInformationCb : Network PWD is not the same as the "
+                            "PWD provisioned");
+                    std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                            ProvisioningStatus >(ESResult::ES_ERROR,
+                            ESState::ES_PROVISIONING_ERROR);
+                    m_provStatusCb(provStatus);
+                    return;
+                }
+
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "checkProvInformationCb : Provisioning is success ");
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONING_SUCCESS);
+                m_provStatusCb(provStatus);
+                return;
+            }
+            else
+            {
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "checkProvInformationCb : Provisioning is failed ");
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
+                m_provStatusCb(provStatus);
+                return;
+            }
+        }
+
+        void RemoteEnrolleeResource::getProvStatusResponse(const HeaderOptions& /*headerOptions*/,
+                const OCRepresentation& rep, const int eCode)
+        {
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : %s, eCode = %d",
+                    rep.getUri().c_str(),
+                    eCode);
+
+            if (eCode != 0)
+            {
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "getProvStatusResponse : Provisioning is failed ");
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
+                m_provStatusCb(provStatus);
+                return;
+            }
+
+            int ps = -1;
+            std::string tnn = "";
+            std::string cd = "";
+
+            rep.getValue(OC_RSRVD_ES_PS, ps);
+            rep.getValue(OC_RSRVD_ES_TNN, tnn);
+            rep.getValue(OC_RSRVD_ES_CD, cd);
+
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ps - %d",
+                    ps);
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : tnn - %s",
+                    tnn.c_str());
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : cd - %s",
+                    cd.c_str());
+
+            if (ps == ES_PS_NEED_PROVISIONING) //Indicates the need for provisioning
+            {
+                OCRepresentation provisioningRepresentation;
+
+                provisioningRepresentation.setValue(OC_RSRVD_ES_TNN,
+                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid));
+                provisioningRepresentation.setValue(OC_RSRVD_ES_CD,
+                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd));
+
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : ssid - %s",
+                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.ssid);
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "getProvStatusResponse : pwd - %s",
+                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.pwd);
+
+                m_ocResource->put(provisioningRepresentation, QueryParamsMap(),
+                        std::function<
+                                void(const HeaderOptions& headerOptions,
+                                        const OCRepresentation& rep, const int eCode) >(
+                        std::bind(&RemoteEnrolleeResource::checkProvInformationCb, this,
+                        std::placeholders::_1, std::placeholders::_2,
+                        std::placeholders::_3)));
+            }
+            else if (ps == ES_PS_PROVISIONING_COMPLETED) //Indicates that provisioning is completed
+            {
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "getProvStatusResponse : Provisioning is successful");
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_OK, ESState::ES_PROVISIONED_ALREADY);
+                m_provStatusCb(provStatus);
+            }
+        }
+
+        void RemoteEnrolleeResource::registerProvStatusCallback(ProvStatusCb provStatusCb)
+        {
+            m_provStatusCb = provStatusCb;
+        }
+
+        ESResult RemoteEnrolleeResource::ESDiscoveryTimeout(unsigned short waittime)
+        {
+            struct timespec startTime;
+            startTime.tv_sec=0;
+            startTime.tv_sec=0;
+            struct timespec currTime;
+            currTime.tv_sec=0;
+            currTime.tv_nsec=0;
+
+            ESResult res = ES_OK;
+            #ifdef _POSIX_MONOTONIC_CLOCK
+                int clock_res = clock_gettime(CLOCK_MONOTONIC, &startTime);
+            #else
+                int clock_res = clock_gettime(CLOCK_REALTIME, &startTime);
+            #endif
+
+            if (0 != clock_res)
+            {
+                return ES_ERROR;
+            }
+
+            while (ES_OK == res || m_discoveryResponse == false)
+            {
+                #ifdef _POSIX_MONOTONIC_CLOCK
+                        clock_res = clock_gettime(CLOCK_MONOTONIC, &currTime);
+                #else
+                        clock_res = clock_gettime(CLOCK_REALTIME, &currTime);
+                #endif
+
+                if (0 != clock_res)
+                {
+                    return ES_ERROR;
+                }
+                long elapsed = (currTime.tv_sec - startTime.tv_sec);
+                if (elapsed > waittime)
+                {
+                    return ES_OK;
+                }
+                if (m_discoveryResponse)
+                {
+                    res = ES_OK;
+                }
+             }
+             return res;
+        }
+
+        void RemoteEnrolleeResource::onDeviceDiscovered(std::shared_ptr<OC::OCResource> resource)
+        {
+            OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "onDeviceDiscovered");
+
+            std::string resourceURI;
+            std::string hostAddress;
+            try
+            {
+                if(resource)
+                {
+                    // Get the resource URI
+                    resourceURI = resource->uri();
+                    OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                            "URI of the resource: %s", resourceURI.c_str());
+
+                    // Get the resource host address
+                    hostAddress = resource->host();
+                    OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                            "Host address of the resource: %s", hostAddress.c_str());
+
+                    std::size_t foundIP =
+                        hostAddress.find(
+                                std::string(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress));
+
+                    if(resourceURI == ES_PROV_RES_URI && foundIP!=std::string::npos)
+                    {
+                        m_ocResource = resource;
+                        m_discoveryResponse = true;
+
+                        OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                                "Found the device with the resource");
+
+                        return;
+                    }
+                    else
+                    {
+                        OC_LOG (ERROR, ES_REMOTE_ENROLLEE_RES_TAG, "NOT the intended resource.");
+                    }
+                }
+                else
+                {
+                    OC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Resource is invalid");
+                }
+
+            }
+            catch(std::exception& e)
+            {
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "Exception in foundResource: %s", e.what());
+            }
+        }
+
+
+        ESResult RemoteEnrolleeResource::constructResourceObject()
+        {
+            if (m_ocResource != nullptr)
+            {
+                throw ESBadRequestException("Remote resource is already created");
+            }
+
+#ifdef REMOTE_ARDUINO_ENROLEE
+            //This process will create OCResource with port 55555 which is specific
+            // to Arduino WiFi enrollee
+            try
+            {
+
+                std::vector< std::string > interface =
+                {   DEFAULT_INTERFACE};
+                std::vector< std::string > resTypes =
+                {   ES_PROV_RES_TYPE};
+
+                OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
+
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_host = %s",
+                        m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "ES_PROV_RES_URI = %s", ES_PROV_RES_URI);
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
+                        m_enrolleeNWProvInfo.connType);
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "resTypes = %s",
+                        resTypes.at(0).c_str());
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "interface = %s", interface.at(0).c_str());
+
+                std::string host;
+                if(m_enrolleeNWProvInfo.needSecuredEasysetup)
+                {
+                    host.append("coaps://");
+                }
+                else
+                {
+                    host.append("coap://");
+                }
+
+                if(m_enrolleeNWProvInfo.connType == CT_ADAPTER_IP)
+                {
+                    // TODO : RemoteEnrollee is current handling easysetup on IP transport.
+                    // WiFiRemoteEnrollee need to extend RemoteEnrollee for providing IP specific
+                    // Enrollee easysetup.
+
+                    host.append(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);
+                    //TODO : If the target Enrollee is not a Arduino Wi-Fi device,
+                    // then the port number will be found during resource discovery instead of
+                    // using 55555
+                    host.append(":55555");
+                }
+
+                OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "HOST = %s", host.c_str());
+
+                m_ocResource = OC::OCPlatform::constructResourceObject(host,
+                        ES_PROV_RES_URI,
+                        m_enrolleeNWProvInfo.connType,
+                        true,
+                        resTypes,
+                        interface);
+                OC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "created OCResource : %s", m_ocResource->uri().c_str());
+
+                return ES_OK;
+            }
+            catch (OCException & e)
+            {
+                OC_LOG_V(ERROR, ES_REMOTE_ENROLLEE_RES_TAG,
+                        "Exception for constructResourceObject : %s", e.reason().c_str());
+            }
+
+#else
+            std::string host("");
+            std::string query("");
+
+            if (m_enrolleeNWProvInfo.needSecuredEasysetup)
+            {
+                host.append("coaps://");
+            }
+            else
+            {
+                host.append("coap://");
+            }
+
+            if (m_enrolleeNWProvInfo.connType == CT_ADAPTER_IP)
+            {
+                // TODO : RemoteEnrollee is current handling easysetup on IP transport.
+                // WiFiRemoteEnrollee need to extend RemoteEnrollee for providing IP specific
+                // Enrollee easysetup.
+
+                host.append(m_enrolleeNWProvInfo.netAddressInfo.WIFI.ipAddress);
+            }
+
+            query.append(ES_BASE_RES_URI);
+            query.append("?rt=");
+            query.append(ES_PROV_RES_TYPE);
+
+            OC_LOG(DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "Before OCPlatform::constructResourceObject");
+
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "host = %s",
+                    host.c_str());
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "query = %s", query.c_str());
+            OC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "m_connectivityType = %d",
+                    m_enrolleeNWProvInfo.connType);
+
+            m_discoveryResponse = false;
+            std::function< void (std::shared_ptr<OC::OCResource>) > onDeviceDiscoveredCb =
+                    std::bind(&RemoteEnrolleeResource::onDeviceDiscovered, this,
+                                                    std::placeholders::_1);
+            OCStackResult result = OC::OCPlatform::findResource("", query, CT_DEFAULT,
+                    onDeviceDiscoveredCb);
+
+            if (result != OCStackResult::OC_STACK_OK)
+            {
+                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
+                        "Failed to create device using constructResourceObject");
+                return ES_ERROR;
+            }
+
+
+            ESResult foundResponse = ESDiscoveryTimeout (DISCOVERY_TIMEOUT);
+
+            if (!m_discoveryResponse)
+            {
+                OC_LOG(ERROR,ES_REMOTE_ENROLLEE_RES_TAG,
+                        "Failed to create device using constructResourceObject");
+                return ES_ERROR;
+            }
+
+            return ES_OK;
+#endif
+        }
+
+        void RemoteEnrolleeResource::provisionEnrollee()
+
+        {
+            if (m_ocResource == nullptr)
+            {
+                throw ESBadRequestException("Resource is not initialized");
+            }
+
+            OC::QueryParamsMap query;
+            OC::OCRepresentation rep;
+
+            std::function< OCStackResult(void) > getProvisioingStatus = [&]
+            {   return m_ocResource->get(m_ocResource->getResourceTypes().at(0),
+                        m_ocResource->getResourceInterfaces().at(0), query,
+                        std::function<
+                        void(const HeaderOptions& headerOptions, const OCRepresentation& rep,
+                                const int eCode) >(
+                                std::bind(&RemoteEnrolleeResource::getProvStatusResponse, this,
+                                        std::placeholders::_1, std::placeholders::_2,
+                                        std::placeholders::_3)));
+            };
+
+            OCStackResult result = getProvisioingStatus();
+
+            if (result != OCStackResult::OC_STACK_OK)
+            {
+                std::shared_ptr< ProvisioningStatus > provStatus = std::make_shared<
+                        ProvisioningStatus >(ESResult::ES_ERROR, ESState::ES_PROVISIONING_ERROR);
+                m_provStatusCb(provStatus);
+                return;
+            }
+        }
+
+        void RemoteEnrolleeResource::unprovisionEnrollee()
+        {
+            if (m_ocResource == nullptr)
+            {
+                throw ESBadRequestException("Resource is not initialized");
+            }
+
+            OCRepresentation provisioningRepresentation;
+
+            provisioningRepresentation.setValue(OC_RSRVD_ES_TNN, "");
+            provisioningRepresentation.setValue(OC_RSRVD_ES_CD, "");
+
+            m_ocResource->post(provisioningRepresentation, QueryParamsMap(),
+                    std::function<
+                            void(const HeaderOptions& headerOptions, const OCRepresentation& rep,
+                                    const int eCode) >(
+                    std::bind(&RemoteEnrolleeResource::checkProvInformationCb, this,
+                    std::placeholders::_1, std::placeholders::_2,
+                    std::placeholders::_3)));
+        }
+    }
+}
index 53b2dbf..57b2d04 100755 (executable)
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
+######################################################################
+# Build script for Arduino Enrollee Sample App
+######################################################################
+
 Import('env')
 
 enrollee_env = env.Clone()
@@ -27,21 +31,20 @@ transport = enrollee_env.get('TARGET_TRANSPORT')
 # Build flags
 ######################################################################
 enrollee_env.PrependUnique(CPPPATH = [
-        '../../../../../resource/oc_logger/include',
-        '../../../../../resource/csdk/logger/include',
-        '../../../../../resource/csdk/stack/include',
-       '../../../../../extlibs/cjson',
-       '../../../sdk/common',
-       '../../../sdk/enrollee/arduino/wifi',
-       '../../../sdk/enrollee/api',
-       '../../../sdk/enrollee/inc',
-       '../../../sdk/enrollee/src'
-       ])
+        env.get('SRC_DIR') + '/resource/oc_logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/stack/include',
+               env.get('SRC_DIR') + '/extlibs/cjson',
+               env.get('SRC_DIR') + '/service/easy-setup/inc',
+               env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi',
+               env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
+               env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
+
 enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
-       
+
 enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
 
-enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESSDKLibrary'])
+enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESEnrolleeSDK'])
 enrollee = enrollee_env.Program('enrollee', 'enrolleewifi.cpp')
 env.CreateBin('enrollee')
 
index b26bc91..b783a17 100644 (file)
@@ -188,9 +188,16 @@ void StartProvisioning()
 {
     OC_LOG(DEBUG, TAG, "StartProvisioning is invoked...");
 
-    if(InitProvisioning()== ES_ERROR)
+    // Initialize the OC Stack in Server mode
+    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
     {
-        OC_LOG(ERROR, TAG, "Init Provisioning Failed");
+        OC_LOG(ERROR, TAG, "OCStack init error!!");
+        return;
+    }
+
+    if (InitProvisioning() == ES_ERROR)
+    {
+        OC_LOG(ERROR, TAG, "Init Provisioning Failed!!");
         return;
     }
 }
@@ -201,11 +208,20 @@ void StopEasySetup()
 
     g_isInitialized = false;
 
-    if(TerminateEasySetup()== ES_ERROR)
+    if (TerminateEasySetup() == ES_ERROR)
     {
-        OC_LOG(ERROR, TAG, "TerminateEasySetup Failed");
+        OC_LOG(ERROR, TAG, "TerminateEasySetup Failed!!");
         return;
     }
+
+    //stop OC Stack
+    if (OCStop() != OC_STACK_OK)
+    {
+        OC_LOG(ERROR, TAG, "OCStack stop failed!!");
+        return;
+    }
+
+    OC_LOG(DEBUG, TAG, "Stopping EasySetup done");
 }
 
 
diff --git a/service/easy-setup/sampleapp/enrollee/linux/SConscript b/service/easy-setup/sampleapp/enrollee/linux/SConscript
new file mode 100644 (file)
index 0000000..683854b
--- /dev/null
@@ -0,0 +1,68 @@
+#######################################################################
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+######################################################################
+# Build script for Linux Enrollee Sample App
+######################################################################
+
+Import('env')
+
+print Dir('#').abspath
+print Dir('.').abspath
+
+enrollee_env = env.Clone()
+transport = enrollee_env.get('TARGET_TRANSPORT')
+
+######################################################################
+# Build flags
+######################################################################
+enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+enrollee_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
+
+if env.get('RELEASE'):
+    enrollee_env.AppendUnique(CCFLAGS = ['-Os'])
+    enrollee_env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+else:
+    enrollee_env.AppendUnique(CCFLAGS = ['-g'])
+
+if env.get('LOGGING'):
+    env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+enrollee_env.PrependUnique(CPPPATH = [
+               env.get('SRC_DIR') + '/resource/include',
+        env.get('SRC_DIR') + '/resource/oc_logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/logger/include',
+        env.get('SRC_DIR') + '/resource/csdk/stack/include',
+        env.get('SRC_DIR') + '/extlibs/cjson',
+        env.get('SRC_DIR') + '/service/easy-setup/inc',
+        env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi',
+        env.get('SRC_DIR') + '/service/easy-setup/enrollee/inc',
+        env.get('SRC_DIR') + '/service/easy-setup/enrollee/src'])
+
+enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'ocsrm', 'pthread', 'connectivity_abstraction','coap', 'ESEnrolleeSDK'])
+
+if env.get('SECURED') == '1':
+       enrollee = enrollee_env.Program('enrollee', 'enrolleewifisecured.cpp')
+else :
+       enrollee = enrollee_env.Program('enrollee', 'enrolleewifi.cpp')
+
+i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)
+
+Alias('enrollee', i_enrollee)
+env.AppendTarget('enrollee')
diff --git a/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.cpp
new file mode 100644 (file)
index 0000000..4c15e22
--- /dev/null
@@ -0,0 +1,196 @@
+//******************************************************************
+//
+// 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 <string.h>
+#include <iostream>
+#include <pthread.h>
+
+#define TAG "TS"
+
+using namespace std;
+
+void *listeningFunc(void*);
+
+/**
+ * @var ssid
+ * @brief Target SSID of the Soft Access point to which the device has to connect
+ */
+static char ssid[] = "EasySetup123";
+
+/**
+ * @var passwd
+ * @brief Password of the Soft Access point to which the device has to connect
+ */
+static char passwd[] = "EasySetup123";
+
+void PrintMenu()
+{
+    cout<<"============"<<endl;
+    cout<<"S: start easy setup"<<endl;
+    cout<<"P: start provisioning resources"<<endl;
+    cout<<"T: terminate"<<endl;
+    cout<<"Q: quit"<<endl;
+    cout<<"============"<<endl;
+}
+
+void EventCallbackInApp(ESResult esResult, EnrolleeState enrolleeState)
+{
+    cout<<"Easy setup event callback"<<endl;
+
+    if(esResult == ES_OK)
+    {
+        if(enrolleeState == ES_ON_BOARDED_STATE)
+        {
+            cout<<"Device is successfully OnBoared on Adhoc network"<<endl;
+        }
+        else if (enrolleeState == ES_PROVISIONED_STATE)
+        {
+            cout<<"Device is provisioned with target network's credentials"<<endl;
+        }
+        else if (enrolleeState == ES_ON_BOARDED_TARGET_NETWORK_STATE)
+        {
+            cout<<"Device is onboarded/connected with target network"<<endl;
+        }
+        else
+        {
+            cout<<"Wrong state !! Easy setup is failed at Enrollee state = "<<enrolleeState<<endl;
+        }
+    }
+    else
+    {
+        cout<<"Easy stup is failed at Enrollee state = "<<enrolleeState<<endl;
+    }
+
+    PrintMenu();
+}
+
+
+void StartEasySetup()
+{
+    cout<<"StartEasySetup and onboarding started.."<<endl;
+
+    if(InitEasySetup(CT_ADAPTER_IP, ssid, passwd, EventCallbackInApp) == ES_ERROR)
+    {
+        cout<<"StartEasySetup and onboarding Fail!!"<<endl;
+        return;
+    }
+
+    pthread_t thread_handle;
+    if (pthread_create(&thread_handle, NULL, listeningFunc, NULL))
+    {
+        cout<<"Thread creation failed"<<endl;
+    }
+}
+
+void StartProvisioning()
+{
+    cout<<"Starting Enrollee Provisioning"<<endl;
+
+    if(InitProvisioning()== ES_ERROR)
+    {
+        cout<<"Init Provisioning Failed"<<endl;
+        return;
+    }
+    cout<<"InitProvisioning:Success"<<endl;
+}
+
+void StopEasySetup()
+{
+    cout<<"StopEasySetup IN"<<endl;
+    if(TerminateEasySetup()== ES_ERROR)
+    {
+        cout<<"return value is: ES_ERROR"<<endl;
+        return;
+    }
+    cout<<"StopEasySetup OUT"<<endl;
+}
+
+int main()
+{
+    cout<<"#########################"<<endl;
+    cout<<"EasySetup Enrollee SAMPLE"<<endl;
+    cout<<"This is modified sample:1"<<endl;
+    cout<<"#########################"<<endl;
+    PrintMenu();
+    char option;
+
+    // Initialize the OC Stack in Server mode
+    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
+    {
+        return -1;
+    }
+
+    while(true)
+    {
+        cin>>option;
+        switch (option)
+        {
+            case 'H': // help
+            case 'h':
+                PrintMenu();
+                break;
+
+            case 'Q': // quit
+            case 'q':
+                cout<<"quit";
+                break;
+
+            case 'S': // start easy setup
+            case 's':
+                StartEasySetup();
+                break;
+
+            case 'P': // start provisioning
+            case 'p':
+                StartProvisioning();
+                break;
+
+            case 'T': // stop easy setup
+            case 't':
+                StopEasySetup();
+                break;
+
+            default:
+                cout<<"wrong option"<<endl;
+                break;
+        }
+        if(option=='Q') break;
+    }
+    return 0;
+}
+
+void *listeningFunc(void*)
+{
+    OCStackResult result;
+
+    while (true)
+    {
+        result = OCProcess();
+        if (result != OC_STACK_OK)
+        {
+           cout<<"OCStack stop error";
+        }
+    }
+    return NULL;
+}
+
index 365ac1a..6b968d3 100644 (file)
@@ -106,22 +106,39 @@ void StartProvisioning()
 {
     cout<<"Starting Enrollee Provisioning"<<endl;
 
-    if(InitProvisioning()== ES_ERROR)
+    // Initialize the OC Stack in Server mode
+    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
     {
-        cout<<"Init Provisioning Failed"<<endl;
+        cout<<"OCStack init error!!"<<endl;
         return;
     }
-    cout<<"InitProvisioning:Success"<<endl;
+
+    if (InitProvisioning() == ES_ERROR)
+    {
+        cout<<"Init Provisioning Failed!!"<<endl;
+        return;
+    }
+
+    cout<<"InitProvisioning Success"<<endl;
 }
 
 void StopEasySetup()
 {
     cout<<"StopEasySetup IN"<<endl;
-    if(TerminateEasySetup()== ES_ERROR)
+
+    if (TerminateEasySetup() == ES_ERROR)
     {
-        cout<<"return value is: ES_ERROR"<<endl;
+        cout<<"TerminateEasySetup Failed!!"<<endl;
         return;
     }
+
+    //stop OC Stack
+    if (OCStop() != OC_STACK_OK)
+    {
+        cout<<"OCStack stop failed!!"<<endl;
+        return;
+    }
+
     cout<<"StopEasySetup OUT"<<endl;
 }
 
@@ -167,7 +184,7 @@ int main()
                 cout<<"wrong option"<<endl;
                 break;
         }
-        if(option=='Q') break;
+        if (option == 'Q' || option == 'q') break;
     }
     return 0;
 }
index fcea067..eb5af47 100644 (file)
@@ -40,7 +40,7 @@ if routing == 'GW':
        env.AppendUnique(CPPDEFINES = ['ROUTING_GATEWAY'])
 elif routing == 'EP':
        env.AppendUnique(CPPDEFINES = ['ROUTING_EP'])
-env.Append(LIBS=['octbstack','connectivity_abstraction','coap', 'ESSDKLibrary','pthread'])
+env.Append(LIBS=['octbstack','connectivity_abstraction','coap', 'ESEnrolleeSDK','pthread'])
 
 if secured == '1':
        env.PrependUnique(CPPPATH = [root_dir + '/external/inc/'])
index a112a4c..641bbfc 100644 (file)
@@ -30,7 +30,7 @@ Build Procedure
 scons -f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP ROUTING=EP RELEASE=0 LOGGING=true
 
 (If needed, modify the parameters accordingly)
-Note :- Upon successful execution of above command(s) RI library and sample console application(for tizen enrollee) 
+Note :- Upon successful execution of above command(s) RI library and sample console application(for tizen enrollee)
         will be generated at path "~/GBS-ROOT/local/repos/<target>/armv7l/RPMS".
 
 Procedure to Execute Sample App:
@@ -53,4 +53,4 @@ Procedure to Execute Sample App:
     7) RPM will be installed in "/usr/apps/"
        Execute the sample app by below commands
         i) cd /usr/apps/com.oic.es.sample/bin
-            a) ./enrollee_wifi 
+            a) ./enrollee_wifi
diff --git a/service/easy-setup/sampleapp/mediator/linux/csdk_sample/SConscript b/service/easy-setup/sampleapp/mediator/linux/csdk_sample/SConscript
new file mode 100644 (file)
index 0000000..4d60705
--- /dev/null
@@ -0,0 +1,64 @@
+#******************************************************************
+#
+# 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.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Import('env')
+
+mediator_env = env.Clone()
+
+target_os = env.get('TARGET_OS')
+
+######################################################################
+# Build flags
+######################################################################
+mediator_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+mediator_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+mediator_env.PrependUnique(CPPPATH = [
+                       env.get('SRC_DIR') + '/resource/csdk/ocmalloc/include',         
+                       env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
+                       env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
+                       env.get('SRC_DIR') + '/resource/csdk/stack/include',
+                       env.get('SRC_DIR') + '/resource/csdk/logger/include',
+                       env.get('SRC_DIR') + '/resource/csdk/security/include',
+                       env.get('SRC_DIR') + '/extlibs/cjson',
+                       env.get('SRC_DIR') + '/service/easy-setup/mediator/csdk/inc',
+                       env.get('SRC_DIR') + '/service/easy-setup/inc'])
+
+mediator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction', 'coap', 'ESMediatorCSDK'])
+
+mediator = mediator_env.Program('mediator_c', 'mediator.cpp')
+
+i_mediator = mediator_env.Install(env.get('BUILD_DIR'), mediator)
+
+Alias('mediator_c', i_mediator)
+env.AppendTarget('mediator_c')
+
+
+
+
+
+
+
+
+
+
+
+
+
old mode 100755 (executable)
new mode 100644 (file)
similarity index 80%
rename from service/easy-setup/sampleapp/mediator/linux/SConscript
rename to service/easy-setup/sampleapp/mediator/linux/richsdk_sample/SConscript
index 9926715..c8c0750
@@ -1,6 +1,6 @@
 #******************************************************************
 #
-# Copyright 2015 Samsung Electronics All Rights Reserved.
+# Copyright 2016 Samsung Electronics All Rights Reserved.
 #
 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
@@ -38,10 +38,11 @@ else:
 if env.get('LOGGING'):
     env.AppendUnique(CPPDEFINES = ['TB_LOG'])
 
+env.AppendUnique(CPPDEFINES = ['CPP_MEDIATOR'])
 
 if target_os not in ['windows', 'winrt']:
     mediator_env.AppendUnique(CXXFLAGS = ['-Wall', '-std=c++0x'])
-    
+       
 mediator_env.PrependUnique(CPPPATH = [
             env.get('SRC_DIR') + '/resource/include',
             env.get('SRC_DIR') + '/resource/oc_logger/include',
@@ -50,18 +51,17 @@ mediator_env.PrependUnique(CPPPATH = [
                        env.get('SRC_DIR') + '/resource/csdk/logger/include',
                        env.get('SRC_DIR') + '/resource/csdk/security/include',
                        env.get('SRC_DIR') + '/extlibs/cjson',
-                       env.get('SRC_DIR') + '/service/easy-setup/sdk/mediator/include',
-                       env.get('SRC_DIR') + '/service/easy-setup/sdk/mediator/src',
-                       env.get('SRC_DIR') + '/service/easy-setup/sdk/common'])
+                       env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/inc',
+                       env.get('SRC_DIR') + '/service/easy-setup/mediator/richsdk/src',
+                       env.get('SRC_DIR') + '/service/easy-setup/inc'])
 
-mediator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction', 'coap', 'ESSDKLibrary'])
+mediator_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction', 'coap', 'ESMediatorRich'])
 if env.get('SECURED') == '1':
        mediator_env.PrependUnique(LIBS = ['ocpmapi', 'ocprovision'])
 
-
-mediator = mediator_env.Program('mediator', 'mediator_cpp.cpp')
+mediator = mediator_env.Program('mediator_rich', 'mediator_cpp.cpp')
 
 i_mediator = mediator_env.Install(env.get('BUILD_DIR'), mediator)
 
-Alias('mediator', i_mediator)
-env.AppendTarget('mediator')
+Alias('mediator_rich', i_mediator)
+env.AppendTarget('mediator_rich')
old mode 100755 (executable)
new mode 100644 (file)
similarity index 99%
rename from service/easy-setup/sampleapp/mediator/linux/mediator_cpp.cpp
rename to service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator_cpp.cpp
index 9e5125d..13e7630
@@ -107,7 +107,7 @@ void initEasySetup()
 
     netInfo.connType = CT_ADAPTER_IP;
     netInfo.isSecured = false;
-    netInfo.needSecuredEasysetup = true;
+    netInfo.needSecuredEasysetup = false;
     OICStrcpy(netInfo.netAddressInfo.WIFI.ipAddress, IPV4_ADDR_SIZE - 1, ipaddress.c_str());
     OICStrcpy(netInfo.netAddressInfo.WIFI.ssid, NET_WIFI_SSID_SIZE - 1, ssid.c_str());
     OICStrcpy(netInfo.netAddressInfo.WIFI.pwd, NET_WIFI_PWD_SIZE - 1, pwd.c_str());
diff --git a/service/easy-setup/sdk/mediator/android/.gitignore b/service/easy-setup/sdk/mediator/android/.gitignore
deleted file mode 100644 (file)
index 6451fc5..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#built application files\r
-*.apk\r
-*.ap_\r
-\r
-# files for the dex VM\r
-*.dex\r
-\r
-# Java class files\r
-*.class\r
-\r
-# generated files\r
-bin/\r
-gen/\r
-\r
-# Local configuration file (sdk path, etc)\r
-local.properties\r
-\r
-# Proguard folder generated by Eclipse \r
-proguard/ \r
-\r
-# Windows thumbnail db\r
-Thumbs.db\r
-\r
-# OSX files\r
-.DS_Store\r
-\r
-# Eclipse project files\r
-.classpath\r
-.project\r
-\r
-#Android Studio & Gradle\r
-.gradle\r
-/local.properties\r
-/.idea/workspace.xml\r
-/.idea/libraries\r
-.DS_Store\r
-/build/*\r
-/base/build/*\r
-/base/obj/*\r
-/base/libs/*\r
-/sample/*\r
-\r
-#Some older projects\r
-/*/out\r
-/*/*/build\r
-/*/*/production\r
-*.iws\r
-*.ipr\r
-*~\r
-*.swp
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/build.gradle b/service/easy-setup/sdk/mediator/android/EasySetupCore/build.gradle
deleted file mode 100644 (file)
index c1f2134..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-apply plugin: 'com.android.library'\r
-// Top-level build file where you can add configuration options common to all sub-projects/modules.\r
-buildscript {\r
-    repositories {\r
-        jcenter()\r
-    }\r
-    dependencies {\r
-        classpath 'com.android.tools.build:gradle:1.2.3'\r
-    }\r
-}\r
-\r
-allprojects {\r
-    repositories {\r
-        jcenter()\r
-    }\r
-}\r
-\r
-android {\r
-    compileSdkVersion 21\r
-    buildToolsVersion '21.1.2'\r
-\r
-    defaultConfig {\r
-        minSdkVersion 21\r
-        targetSdkVersion 21\r
-    }\r
-\r
-    buildTypes {\r
-        release {\r
-            minifyEnabled false\r
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'\r
-        }\r
-    }\r
-    sourceSets {\r
-        main { java.srcDirs = ['src/main/java', 'src/main/java/common', 'src/main/java/interface'] }\r
-    }\r
-}\r
-\r
-dependencies {\r
-    compile project(':iotivity-armeabi-base-debug')\r
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle b/service/easy-setup/sdk/mediator/android/EasySetupCore/settings.gradle
deleted file mode 100644 (file)
index 3f6e49d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-include ':iotivity-armeabi-base-debug'
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/androidTest.iml b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/androidTest.iml
deleted file mode 100644 (file)
index a862cc8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="classes" level="project" />
-    <orderEntry type="module" module-name="main" />
-  </component>
-</module>
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceConfigTest.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceConfigTest.java
deleted file mode 100755 (executable)
index 54fec21..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import android.test.AndroidTestCase;\r
-\r
-\r
-public class EasySetupServiceConfigTest extends AndroidTestCase {\r
-\r
-\r
-    public void testConstruction() {\r
-\r
-        EasySetupService service = EasySetupService.getInstance(getContext(), new EasySetupStatus() {\r
-            @Override\r
-            public void onFinished(EnrolleeDevice enrolledevice) {\r
-\r
-            }\r
-\r
-            @Override\r
-            public void onProgress(EnrolleeDevice enrolleeDevice) {\r
-\r
-            }\r
-        });\r
-\r
-        assertTrue(service != null);\r
-\r
-\r
-    }\r
-\r
-    public void testFinish() {\r
-        EasySetupService service = EasySetupService.getInstance(getContext(), new EasySetupStatus() {\r
-            @Override\r
-            public void onFinished(EnrolleeDevice enrolledevice) {\r
-\r
-            }\r
-\r
-            @Override\r
-            public void onProgress(EnrolleeDevice enrolleeDevice) {\r
-\r
-            }\r
-        });\r
-        service.finish();\r
-\r
-        // No runtime exception is thrown means test is successful\r
-        assertTrue(true);\r
-\r
-    }\r
-\r
-    public void testEnrolleeDeviceFacotryConstruction() {\r
-        EnrolleeDeviceFactory factory = EnrolleeDeviceFactory.newInstance(getContext());\r
-        assertTrue(factory != null);\r
-    }\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceTest.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupServiceTest.java
deleted file mode 100755 (executable)
index 9ac1a18..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-//******************************************************************\r
-//\r
-// Copyright 2015 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import android.net.wifi.WifiConfiguration;\r
-import android.test.AndroidTestCase;\r
-import android.util.Log;\r
-\r
-import java.io.IOException;\r
-\r
-public class EasySetupServiceTest extends AndroidTestCase {\r
-\r
-\r
-    public void testStartSetupWithWiFiOnboarding() {\r
-\r
-        EasySetupService mService;\r
-        EnrolleeDevice mDevice;\r
-        EnrolleeDeviceFactory mFactory;\r
-\r
-        final Object lock = new Object();\r
-\r
-\r
-        /* Create Easy Setup service */\r
-        mService = EasySetupService.getInstance(getContext(), new EasySetupStatus() {\r
-            @Override\r
-            public void onFinished(EnrolleeDevice enrolledevice) {\r
-\r
-                //countDownLatch.countDown();\r
-                Utility.toNotify(lock);\r
-\r
-                if (enrolledevice.isSetupSuccessful()) {\r
-\r
-                    if (enrolledevice.mOnBoardingConfig.getConnType() == WiFiOnBoardingConfig.ConnType.WiFi) {\r
-                        IpOnBoardingConnection conn = (IpOnBoardingConnection) enrolledevice.getConnection();\r
-                        String ip = conn.getIp();\r
-                        if (ip == null || ip.isEmpty()) {\r
-                            assertTrue(false);\r
-                            return;\r
-                        }\r
-                        String mac = conn.getHardwareAddress();\r
-                        if (mac == null || mac.isEmpty()) {\r
-                            assertTrue(false);\r
-                            return;\r
-                        }\r
-                        // Device configured successfully\r
-                        assertTrue(true);\r
-                    }\r
-\r
-                } else {\r
-                    assertTrue(false);\r
-                }\r
-            }\r
-\r
-            @Override\r
-            public void onProgress(EnrolleeDevice enrolleeDevice) {\r
-                // Handled in EasySetupStatusTest\r
-            }\r
-        });\r
-\r
-\r
-        /* Create On boarding configuration */\r
-        WiFiOnBoardingConfig mWiFiOnBoardingConfig = new WiFiOnBoardingConfig();\r
-        mWiFiOnBoardingConfig.setSSId("EasySetup123");\r
-        mWiFiOnBoardingConfig.setSharedKey("EasySetup123");\r
-        mWiFiOnBoardingConfig.setAuthAlgo(WifiConfiguration.AuthAlgorithm.OPEN);\r
-        mWiFiOnBoardingConfig.setKms(WifiConfiguration.KeyMgmt.WPA_PSK);\r
-\r
-        /* Create provisioning configuration */\r
-        WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");\r
-\r
-        /* Create enrolling device factory instance */\r
-        mFactory = EnrolleeDeviceFactory.newInstance(getContext());\r
-\r
-        /* Check if the factory created successfully */\r
-        assertTrue(mFactory != null);\r
-\r
-        /* Create enrolling device */\r
-        mDevice = mFactory.newEnrolleeDevice(mWiFiOnBoardingConfig, mWiFiProvConfig);\r
-\r
-        /* Check if the the device is created successfully*/\r
-        assertTrue(mDevice != null);\r
-\r
-        /* Check if the the correct device is created as per the given configuration*/\r
-        assertTrue((mDevice instanceof EnrolleeDeviceWiFiOnboarding));\r
-\r
-\r
-        try {\r
-            mService.startSetup(mDevice);\r
-            // If no exception is thrown means setup started successfully.\r
-            assertTrue(true);\r
-\r
-        } catch (IOException e) {\r
-            assertTrue(false);\r
-        }\r
-\r
-        try {\r
-\r
-            Utility.toWait(lock);\r
-\r
-            Log.i("EasySetupTest", "Lock is released");\r
-\r
-            if (!mDevice.isSetupSuccessful()) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            IpOnBoardingConnection conn = (IpOnBoardingConnection) mDevice.getConnection();\r
-            if (conn == null) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            String ip = conn.getIp();\r
-            if (ip == null || ip.isEmpty()) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            String mac = conn.getHardwareAddress();\r
-            if (mac == null || mac.isEmpty()) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            Log.i("EasySetupTest", "Ip" + conn.getIp());\r
-            Log.i("EasySetupTest", "MAC" + conn.getHardwareAddress());\r
-\r
-            // Device configured successfully\r
-            assertTrue(true);\r
-\r
-        } catch (Exception e) {\r
-            e.printStackTrace();\r
-            assertTrue(false);\r
-        }\r
-\r
-    }\r
-\r
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupStatusTest.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EasySetupStatusTest.java
deleted file mode 100755 (executable)
index d1a1370..0000000
+++ /dev/null
@@ -1,163 +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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-package org.iotivity.service.easysetup.mediator;
-
-import android.net.wifi.WifiConfiguration;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import java.io.IOException;
-
-public class EasySetupStatusTest extends AndroidTestCase {
-
-
-    public void testStartSetupWithWiFiOnboarding() {
-
-        EasySetupService mService;
-        EnrolleeDevice mDevice;
-        EnrolleeDeviceFactory mFactory;
-
-        final Object lock = new Object();
-
-
-        /* Create Easy Setup service */
-        mService = EasySetupService.getInstance(getContext(), new EasySetupStatus() {
-            EnrolleeState old_state = null;
-
-            @Override
-            public void onFinished(EnrolleeDevice enrolledevice) {
-
-                //countDownLatch.countDown();
-                Utility.toNotify(lock);
-
-                if (enrolledevice.isSetupSuccessful()) {
-
-                    if (enrolledevice.mOnBoardingConfig.getConnType() == WiFiOnBoardingConfig.ConnType.WiFi) {
-                        IpOnBoardingConnection conn = (IpOnBoardingConnection) enrolledevice.getConnection();
-                        String ip = conn.getIp();
-                        if (ip == null || ip.isEmpty()) {
-                            assertTrue(false);
-                            return;
-                        }
-                        String mac = conn.getHardwareAddress();
-                        if (mac == null || mac.isEmpty()) {
-                            assertTrue(false);
-                            return;
-                        }
-                        // Device configured successfully
-                        assertTrue(true);
-                    }
-
-                } else {
-                    assertTrue(false);
-                }
-            }
-
-            @Override
-            public void onProgress(EnrolleeDevice enrolleeDevice) {
-                EnrolleeState state = enrolleeDevice.mState;
-                // TODO
-                switch (state) {
-                    case DEVICE_INIT_STATE:
-                        Log.d("enrollee state", "DEVICE_INIT_STATE");
-                        assertTrue(false);
-                        break;
-                    case DEVICE_ON_BOARDING_STATE:
-                        if (old_state == null)
-                            assertTrue(true);
-                        else assertTrue(false);
-                        old_state = EnrolleeState.DEVICE_ON_BOARDING_STATE;
-                        Log.d("enrollee state", "DEVICE_ON_BOARDING_STATE");
-                        break;
-
-                    case DEVICE_ON_BOARDED_STATE:
-                        if (old_state == EnrolleeState.DEVICE_ON_BOARDING_STATE)
-                            assertTrue(true);
-                        else assertTrue(false);
-                        old_state = EnrolleeState.DEVICE_ON_BOARDED_STATE;
-                        Log.d("enrollee state", "DEVICE_ON_BOARDED_STATE");
-                        break;
-
-                    case DEVICE_PROVISIONING_STATE:
-                        if (old_state == EnrolleeState.DEVICE_ON_BOARDED_STATE)
-                            assertTrue(true);
-                        else assertTrue(false);
-                        old_state = EnrolleeState.DEVICE_PROVISIONING_STATE;
-                        Log.d("enrollee state", "DEVICE_PROVISIONING_STATE");
-                        break;
-
-                    case DEVICE_PROVISIONED_STATE:
-                        if (old_state == EnrolleeState.DEVICE_PROVISIONING_STATE)
-                            assertTrue(true);
-                        else assertTrue(false);
-                        Log.d("enrollee state", "DEVICE_PROVISIONING_SUCCESS_STATE");
-                        break;
-
-                    default:
-                        Log.d("enrollee state", "unknown state");
-                        assertTrue(false);
-                        break;
-                }
-
-            }
-        });
-
-
-        /* Create On boarding configuration */
-        WiFiOnBoardingConfig mWiFiOnBoardingConfig = new WiFiOnBoardingConfig();
-        mWiFiOnBoardingConfig.setSSId("EasySetup123");
-        mWiFiOnBoardingConfig.setSharedKey("EasySetup123");
-        mWiFiOnBoardingConfig.setAuthAlgo(WifiConfiguration.AuthAlgorithm.OPEN);
-        mWiFiOnBoardingConfig.setKms(WifiConfiguration.KeyMgmt.WPA_PSK);
-
-        /* Create provisioning configuration */
-        WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");
-
-        /* Create enrolling device factory instance */
-        mFactory = EnrolleeDeviceFactory.newInstance(getContext());
-
-        /* Create enrolling device */
-        mDevice = mFactory.newEnrolleeDevice(mWiFiOnBoardingConfig, mWiFiProvConfig);
-
-        try {
-            mService.startSetup(mDevice);
-        } catch (IOException e) {
-        }
-
-        try {
-
-            Utility.toWait(lock);
-
-            Log.i("EasySetupTest", "Lock is released");
-
-            IpOnBoardingConnection conn = (IpOnBoardingConnection) mDevice.getConnection();
-
-            Log.i("EasySetupTest", "Ip" + conn.getIp());
-            Log.i("EasySetupTest", "MAC" + conn.getHardwareAddress());
-
-            // Device configured successfully
-
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-    }
-
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactoryTest.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactoryTest.java
deleted file mode 100755 (executable)
index 42114c9..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import android.net.wifi.WifiConfiguration;\r
-import android.test.AndroidTestCase;\r
-\r
-public class EnrolleeDeviceFactoryTest extends AndroidTestCase {\r
-\r
-    EnrolleeDeviceFactory mFactory;\r
-\r
-    @Override\r
-    protected void setUp() throws Exception {\r
-        super.setUp();\r
-        mFactory = EnrolleeDeviceFactory.newInstance(getContext());\r
-        assertTrue(mFactory != null);\r
-\r
-    }\r
-\r
-    @Override\r
-    protected void tearDown() throws Exception {\r
-        super.tearDown();\r
-        mFactory = null;\r
-    }\r
-\r
-\r
-    public void testNewEnrolleeDevice_with_WiFiOnboarding() {\r
-\r
-        /* Create On boarding configuration */\r
-        WiFiOnBoardingConfig mWiFiOnBoardingConfig = new WiFiOnBoardingConfig();\r
-        mWiFiOnBoardingConfig.setSSId("EasySetup123");\r
-        mWiFiOnBoardingConfig.setSharedKey("EasySetup123");\r
-        mWiFiOnBoardingConfig.setAuthAlgo(WifiConfiguration.AuthAlgorithm.OPEN);\r
-        mWiFiOnBoardingConfig.setKms(WifiConfiguration.KeyMgmt.WPA_PSK);\r
-\r
-        /* Create provisioning configuration */\r
-        WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");\r
-\r
-        /* Create enrolling device */\r
-        EnrolleeDevice device = mFactory.newEnrolleeDevice(mWiFiOnBoardingConfig, mWiFiProvConfig);\r
-\r
-        /* Check if the the device is created */\r
-        assertTrue(device != null);\r
-\r
-        /* Check if the the correct device is created as per the given configuration*/\r
-        assertTrue((device instanceof EnrolleeDeviceWiFiOnboarding));\r
-\r
-    }\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/AndroidManifest.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/AndroidManifest.xml
deleted file mode 100644 (file)
index 64487cd..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="org.iotivity.service.easysetup.mediator"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk
-        android:minSdkVersion="8"
-        android:targetSdkVersion="21" />
-
-    <application
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-    </application>
-
-</manifest>
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupCallbackHandler.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupCallbackHandler.java
deleted file mode 100755 (executable)
index 685a12a..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p>\r
- * <p>\r
- * <p>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p>\r
- * ****************************************************************\r
- */\r
-package org.iotivity.service.easysetup.core;\r
-\r
-import android.util.Log;\r
-\r
-public class EasySetupCallbackHandler {\r
-    private static final String TAG = "ESCallbackHandler";\r
-    ProvisionEnrollee provisioningListener;\r
-\r
-    private static EasySetupCallbackHandler easySetupCallbackHandlerObj;\r
-\r
-    public static synchronized EasySetupCallbackHandler getInstance() {\r
-        if (null == easySetupCallbackHandlerObj) {\r
-            easySetupCallbackHandlerObj = new EasySetupCallbackHandler();\r
-        }\r
-        return easySetupCallbackHandlerObj;\r
-    }\r
-\r
-    public void ProvisioningStatusCallBack(int statuscode) {\r
-        Log.d(TAG,\r
-                "onFinishProvisioning() inside Android Java application. statuscode - "\r
-                        + statuscode);\r
-        if (this.provisioningListener != null) {\r
-            this.provisioningListener.ProvisioningStatusCallBack(statuscode);\r
-        } else {\r
-            Log.e(TAG, "provisioningListener is not registered");\r
-        }\r
-    }\r
-\r
-    public void registerProvisioningHandler(\r
-            ProvisionEnrollee provisioningListener) {\r
-        this.provisioningListener = provisioningListener;\r
-    }\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EasySetupManager.java
deleted file mode 100755 (executable)
index c85b051..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p>\r
- * <p>\r
- * <p>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p>\r
- * ****************************************************************\r
- */\r
-package org.iotivity.service.easysetup.core;\r
-\r
-import android.content.Context;\r
-\r
-import org.iotivity.ca.CaInterface;\r
-\r
-public class EasySetupManager {\r
-    private native void InitEasySetup();\r
-\r
-    private native void TerminateEasySetup();\r
-\r
-    // TODO : "OcConnectivityType connectivityType" has to be passed as the\r
-    // second parameter for PerformEasySetup\r
-    // instead of integer\r
-    private native void ProvisionEnrollee(String ipAddress, String netSSID,\r
-                                          String netPWD, int connectivityType);\r
-\r
-    private native void StopEnrolleeProvisioning(int connectivityType);\r
-\r
-    public static native void initialize(Context context);\r
-\r
-    private static EasySetupManager easySetupManagerInterfaceObj = null;\r
-    private Context appContext = null;\r
-\r
-    static {\r
-        // Load Easy Setup JNI interface\r
-        System.loadLibrary("gnustl_shared");\r
-        System.loadLibrary("octbstack");\r
-        System.loadLibrary("connectivity_abstraction");\r
-        System.loadLibrary("easysetup-jni");\r
-    }\r
-\r
-    private EasySetupManager() {\r
-\r
-    }\r
-\r
-    /**\r
-     * Function for Getting instance of EasySetupManager object.\r
-     *\r
-     * @return EasySetupManager instance.\r
-     *\r
-     */\r
-    public static synchronized EasySetupManager getInstance() {\r
-        if (null == easySetupManagerInterfaceObj) {\r
-            easySetupManagerInterfaceObj = new EasySetupManager();\r
-        }\r
-        return easySetupManagerInterfaceObj;\r
-    }\r
-\r
-    public void setApplicationContext(Context context) {\r
-        appContext = context;\r
-    }\r
-\r
-    public void initEasySetup() {\r
-        CaInterface.initialize(appContext);\r
-        InitEasySetup();\r
-    }\r
-\r
-    public void terminateEasySetup() {\r
-        TerminateEasySetup();\r
-    }\r
-\r
-    public void provisionEnrollee(String ipAddress, String netSSID,\r
-                                  String netPWD, int connectivityType) {\r
-\r
-        ProvisionEnrollee(ipAddress, netSSID, netPWD, connectivityType);\r
-    }\r
-\r
-    public void stopEnrolleeProvisioning(int connectivityType) {\r
-        StopEnrolleeProvisioning(connectivityType);\r
-    }\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeInfo.java
deleted file mode 100755 (executable)
index 29b7432..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.core;
-
-public class EnrolleeInfo {
-
-    private String IpAddr;
-    private String HWAddr;
-    private String Device;
-    private boolean isReachable;
-
-    public String getIpAddr() {
-        return IpAddr;
-    }
-
-    public void setIpAddr(String ipAddr) {
-        IpAddr = ipAddr;
-    }
-
-    public String getHWAddr() {
-        return HWAddr;
-    }
-
-    public void setHWAddr(String hWAddr) {
-        HWAddr = hWAddr;
-    }
-
-    public String getDevice() {
-        return Device;
-    }
-
-    public void setDevice(String device) {
-        Device = device;
-    }
-
-    public boolean isReachable() {
-        return isReachable;
-    }
-
-    public void setReachable(boolean isReachable) {
-        this.isReachable = isReachable;
-    }
-
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeOnBoardingInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeOnBoardingInfo.java
deleted file mode 100755 (executable)
index cb67017..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-package org.iotivity.service.easysetup.core;
-
-public class EnrolleeOnBoardingInfo {
-
-    private String IpAddr;
-    private String HWAddr;
-    private String Device;
-    private boolean isReachable;
-    private boolean isAdditionNotified;
-    private boolean isRemovalNotified;
-
-    public EnrolleeOnBoardingInfo(String ipAddr, String hWAddr, String device,
-                                  boolean isReachable, boolean isRemovalNotified,
-                                  boolean isAdditionNotified) {
-        this.IpAddr = ipAddr;
-        this.HWAddr = hWAddr;
-        this.Device = device;
-        this.isReachable = isReachable;
-        this.isRemovalNotified = isRemovalNotified;
-        this.isAdditionNotified = isAdditionNotified;
-    }
-
-    public String getIpAddr() {
-        return IpAddr;
-    }
-
-    public void setIpAddr(String ipAddr) {
-        IpAddr = ipAddr;
-    }
-
-    public String getHWAddr() {
-        return HWAddr;
-    }
-
-    public void setHWAddr(String hWAddr) {
-        HWAddr = hWAddr;
-    }
-
-    public String getDevice() {
-        return Device;
-    }
-
-    public void setDevice(String device) {
-        Device = device;
-    }
-
-    public boolean isReachable() {
-        return isReachable;
-    }
-
-    public void setReachable(boolean isReachable) {
-        this.isReachable = isReachable;
-    }
-
-    public boolean isRemovalNotified() {
-        return isRemovalNotified;
-    }
-
-    public void setRemovalNotified(boolean isRemovalNotified) {
-        this.isRemovalNotified = isRemovalNotified;
-    }
-
-    public boolean isAdditionNotified() {
-        return isAdditionNotified;
-    }
-
-    public void setAdditionNotified(boolean isAdditionNotified) {
-        this.isAdditionNotified = isAdditionNotified;
-    }
-
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IOnBoardingStatus.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IOnBoardingStatus.java
deleted file mode 100755 (executable)
index c709af8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-package org.iotivity.service.easysetup.core;
-
-public interface IOnBoardingStatus {
-
-    /**
-     * Interface called when the scan method finishes. Network operations should
-     * not execute on UI thread
-     *
-     * @param clients of {@link EnrolleeInfo}
-     */
-
-    public void deviceOnBoardingStatus(EnrolleeInfo clients);
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IProvisioningListener.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/IProvisioningListener.java
deleted file mode 100755 (executable)
index 8c0118f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p>\r
- * <p>\r
- * <p>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p>\r
- * ****************************************************************\r
- */\r
-package org.iotivity.service.easysetup.core;\r
-\r
-public interface IProvisioningListener {\r
-    /**\r
-     * Interface called when the provisioning finishes\r
-     */\r
-\r
-    public void onFinishProvisioning(int statuscode);\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ProvisionEnrollee.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ProvisionEnrollee.java
deleted file mode 100755 (executable)
index e98bd66..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p>\r
- * <p>\r
- * <p>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.core;\r
-\r
-import android.content.Context;\r
-import android.util.Log;\r
-\r
-public class ProvisionEnrollee {\r
-    private static final String TAG = "ProvisionEnrollee";\r
-    private IProvisioningListener provisioningListener;\r
-\r
-    /**\r
-     * Constructor for ProvisionEnrollee. Constructs a new ProvisionEnrollee.\r
-     */\r
-    public ProvisionEnrollee(Context context) {\r
-\r
-    }\r
-\r
-    public void provisionEnrollee(String ipAddress, String netSSID,\r
-                                  String netPWD, int connectivityType) {\r
-        Log.i(TAG, "JNI start provisioning is called ");\r
-    }\r
-\r
-    public void stopEnrolleeProvisioning(int connectivityType) {\r
-        Log.i(TAG, "JNI stop provisioning is called ");\r
-    }\r
-\r
-    public void ProvisioningStatusCallBack(int statuscode) {\r
-        Log.d(TAG,\r
-                "JNI onFinishProvisioning() inside Android Java application. statuscode - "\r
-                        + statuscode);\r
-        this.provisioningListener.onFinishProvisioning(statuscode);\r
-    }\r
-\r
-    public void registerProvisioningHandler(\r
-            IProvisioningListener provisioningListener) {\r
-        this.provisioningListener = provisioningListener;\r
-        EasySetupCallbackHandler.getInstance()\r
-                .registerProvisioningHandler(this);\r
-        Log.i(TAG, "JNI Callback is registered for getting provisioning status");\r
-    }\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ip/WiFiSoftAPManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/ip/WiFiSoftAPManager.java
deleted file mode 100755 (executable)
index 40bfd12..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.core.ip;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.util.ArrayList;
-
-import android.content.Context;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiManager;
-import android.util.Log;
-
-import org.iotivity.service.easysetup.core.EnrolleeInfo;
-import org.iotivity.service.easysetup.core.EnrolleeOnBoardingInfo;
-import org.iotivity.service.easysetup.core.IOnBoardingStatus;
-
-/**
- * WiFiSoftAPManager provides wrapper methods for accessing Android Soft Access Point functionality.
- * This is a convenient class, providing Android "WiFiManager" kind of equivalent class for Soft AP.
- * <p>
- * Note: Android doesn't provide public APIs for Soft Access Point feature access.
- * This class provides only reference implementation to use the Soft AP and it uses Java reflection
- * for access Soft Access point features.
- * </p>
- */
-public class WiFiSoftAPManager {
-    private static final String TAG = WiFiSoftAPManager.class.getName();
-    private final WifiManager mWifiManager;
-    private Context context;
-    static ArrayList<EnrolleeOnBoardingInfo> appNotification =
-            new ArrayList<EnrolleeOnBoardingInfo>();
-    IOnBoardingStatus finishListener = null;
-
-    public enum WIFI_AP_STATE {
-        WIFI_AP_STATE_DISABLING,
-        WIFI_AP_STATE_DISABLED,
-        WIFI_AP_STATE_ENABLING,
-        WIFI_AP_STATE_ENABLED,
-        WIFI_AP_STATE_FAILED
-    }
-
-    public WiFiSoftAPManager(Context context) {
-        this.context = context;
-        mWifiManager = (WifiManager) this.context
-                .getSystemService(Context.WIFI_SERVICE);
-    }
-
-    /*
-    * Utility API to check the validity of the MAC Address read from the ARP cache
-    */
-    private boolean CheckIfValidMacAddress(String macAddr) {
-        if (macAddr.matches("..:..:..:..:..:..")) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /*
-    * The API is used for checking the device entry in the list maintained for the device
-    * notifications.
-    * If device entry is not found in the list, app is notified.
-    * If the device entry is found in the device, as application is already notified it will
-    * continue
-    */
-    private boolean CheckForDeviceEntryAndNotify(String ipAddr,
-                                                 String macAddr, boolean isReachable) {
-        final EnrolleeInfo result = new EnrolleeInfo();
-        boolean deviceAddedToList = false;
-
-        if (appNotification.size() > 0) {
-            for (EnrolleeOnBoardingInfo ipDeviceOnBoardingNotification : appNotification) {
-                EnrolleeOnBoardingInfo ipEnrolleeDevice = (EnrolleeOnBoardingInfo)
-                        ipDeviceOnBoardingNotification;
-                boolean macAddressComparison = ipEnrolleeDevice.getHWAddr().equalsIgnoreCase(
-                        macAddr) ? true : false;
-
-                if (macAddressComparison) {
-                    deviceAddedToList = true;
-
-                    if (ipDeviceOnBoardingNotification
-                            .isAdditionNotified()
-                            && isReachable) {
-                        continue;
-                    } else if (ipDeviceOnBoardingNotification
-                            .isRemovalNotified()
-                            && !isReachable) {
-                        continue;
-                    } else {
-                        result.setIpAddr(ipAddr);
-                        result.setHWAddr(macAddr);
-                        result.setReachable(isReachable);
-
-                        appNotification
-                                .remove(ipDeviceOnBoardingNotification);
-                        if (isReachable) {
-                            appNotification
-                                    .add(new EnrolleeOnBoardingInfo(ipAddr, macAddr, "",
-                                            isReachable,
-                                            false, true));
-                        } else {
-                            //This case will happen during the transition from connected to
-                            // disconneted. This case need not be notified to application.
-                            // Notifying this state will cause failure of OnBoarding
-                        }
-                        NotifyApplication(result);
-                        return true;
-                    }
-                }
-            }
-            if (!deviceAddedToList) {
-                if (isReachable) {
-                    appNotification
-                            .add(new EnrolleeOnBoardingInfo(ipAddr, macAddr, "", isReachable, false,
-                                    true));
-
-                    result.setIpAddr(ipAddr);
-                    result.setHWAddr(macAddr);
-                    result.setReachable(isReachable);
-
-                    NotifyApplication(result);
-                } else {
-                    //This case will happen for the first time device is listed, but reachability
-                    // is false. This case need not be notified to application. Notifying this
-                    // state will cause failure of OnBoarding
-                }
-                return true;
-            }
-        } else {
-            if (isReachable) {
-                appNotification
-                        .add(new EnrolleeOnBoardingInfo(ipAddr, macAddr, "", isReachable, false,
-                                true));
-                result.setIpAddr(ipAddr);
-                result.setHWAddr(macAddr);
-                result.setReachable(isReachable);
-
-                NotifyApplication(result);
-            } else {
-                //This case will happen for the first time device is listed,  but
-                // reachability is false. This case need not be notified to
-                // application. Notifying this state will cause failure of OnBoarding
-            }
-
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Start WiFi Soft AccessPoint mode with the specified configuration.
-     * If the Soft AP is already running, this API call will update the new configuration.
-     * <p>
-     * Note: Starting Wi-Fi Soft Access Point will disable the Wi-Fi normal operation.
-     * </p>
-     *
-     * @param wifiConfig SSID, security and channel details as part of WifiConfiguration
-     * @return {@code true} if the operation succeeds, {@code false} otherwise
-     */
-    public boolean setWifiApEnabled(WifiConfiguration wifiConfig,
-                                    boolean enabled) {
-        try {
-            appNotification.clear();
-            // Stopping Wi-Fi mode
-            if (enabled) {
-                mWifiManager.setWifiEnabled(false);
-            }
-
-            Method method = mWifiManager.getClass().getMethod(
-                    "setWifiApEnabled", WifiConfiguration.class, boolean.class);
-            return (Boolean) method.invoke(mWifiManager, wifiConfig, enabled);
-        } catch (Exception e) {
-            Log.e(this.getClass().toString(), "", e);
-            return false;
-        }
-    }
-
-    /**
-     * Gets a list of the Soft AP clients connected to the Wi-Fi Soft Access point
-     *
-     * @param finishListener   Interface called when the scan method finishes
-     * @param reachableTimeout Reachable Timeout in miliseconds
-     */
-    public synchronized void getClientList(IOnBoardingStatus finishListener, final int
-            reachableTimeout) {
-        this.finishListener = finishListener;
-        //Clearing the scan list for providing u
-        appNotification.clear();
-        Runnable runnable = new Runnable() {
-            public void run() {
-                Log.i(TAG, "Scanning enrolling device in the network");
-
-                BufferedReader bufferedReader = null;
-
-                try {
-                    // Note : This is a reference implementation for getting the list of Enrollee's
-                    // connected to the Soft AP.
-                    // There is no Android API for getting list of connected devices to the Soft AP.
-                    // The connected device information is fetched from Arp cache for Soft AP and
-                    // it is maintained in the file "/proc/net/arp"
-                    // This holds an ASCII readable dump of the kernel ARP  table  used
-                    // for  address resolutions.  It will show both dynamically learned
-                    // and preprogrammed ARP entries.  The format is:
-                    // IP address     HW type   Flags     HW address          Mask   Device
-                    // 192.168.0.50   0x1       0x2       00:50:BF:25:68:F3   *      eth0
-                    // 192.168.0.250  0x1       0xc       00:00:00:00:00:00   *      eth0
-                    bufferedReader = new BufferedReader(new InputStreamReader(
-                            new FileInputStream("/proc/net/arp"), "UTF-8"));
-                    String line;
-                    while ((line = bufferedReader.readLine()) != null) {
-                        //ARP entries are splitted using Regex for getting the IP and MAC Address
-                        // info
-                        String[] arpEntry = line.split(" +");
-
-                        if ((arpEntry != null) && (arpEntry.length >= 4)) {
-                            String ipAddr = arpEntry[0];
-                            String macAddr = arpEntry[3];
-
-
-                            // Checking if the string is matching MAC Address is matching the
-                            // standard MAC address format.
-                            // If the entry is not matching with MAC address format,
-                            // it will continue
-                            if (CheckIfValidMacAddress(macAddr)) {
-                                boolean isReachable = InetAddress.getByName(
-                                        ipAddr).isReachable(
-                                        reachableTimeout);
-
-                                Log.i("exec statement", ipAddr);
-                                Log.i("Return Value", " " + isReachable);
-
-                                // Checking if the app notification entries are available in the
-                                // list for the current device
-                                // API returns true is there is a notification to the application.
-                                // API returns false if there is no entry or if device is
-                                // already notified
-                                if (CheckForDeviceEntryAndNotify(ipAddr, macAddr, isReachable)) {
-                                    break;
-                                }
-                            }
-                        }
-                    }
-                } catch (Exception e) {
-                    Log.e(this.getClass().toString(), e.toString());
-                } finally {
-                    try {
-                        bufferedReader.close();
-                    } catch (IOException e) {
-                        Log.e(this.getClass().toString(), e.getMessage());
-                    }
-                }
-            }
-        };
-
-        Thread mythread = new Thread(runnable);
-        mythread.start();
-    }
-
-    void NotifyApplication(final EnrolleeInfo result) {
-        // Get a handler that can be used to post to the main thread
-/*
-        Handler mainHandler = new Handler(context.getMainLooper());
-        Runnable myRunnable = new Runnable() {
-            @Override
-            public void run() {
-                finishListener.deviceOnBoardingStatus(result);
-            }
-        };
-        mainHandler.post(myRunnable);
-*/
-        Log.i(TAG, "Scanning is finished with result, IP : " + result.getIpAddr() + "Notifying " +
-                "to Application");
-        finishListener.deviceOnBoardingStatus(result);
-
-    }
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupService.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupService.java
deleted file mode 100755 (executable)
index 826bffa..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import android.content.Context;\r
-import android.util.Log;\r
-\r
-import org.iotivity.service.easysetup.core.EasySetupManager;\r
-import org.iotivity.service.easysetup.core.ProvisionEnrollee;\r
-\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-\r
-/**\r
- * This is facade class, a single point of contact for Application.\r
- * It contains set of APIs to do easy setup of the enrolling device.\r
- * ON-BOARDING - This is a step to establish connectivity between the device & Mediator device.\r
- * PROVISION   - This is a step where the netowork's detail & credentials are given to the\r
- * enrolling device.\r
- */\r
-public class EasySetupService {\r
-\r
-    private static final String TAG = EasySetupService.class.getName();\r
-\r
-    private static EasySetupService sInstance;\r
-\r
-    private final EasySetupStatus mCallback;\r
-\r
-    private ArrayList<EnrolleeDevice> mEnrolleeDeviceList;\r
-\r
-    private final ProvisioningCallback mProvisioningCallback;\r
-\r
-    private static Context mContext;\r
-\r
-\r
-    ProvisionEnrollee mProvisionEnrolleeInstance;\r
-\r
-    private EasySetupService(EasySetupStatus callback) {\r
-        mCallback = callback;\r
-        mProvisioningCallback = new ProvisioningCallbackImpl(mCallback);\r
-        mEnrolleeDeviceList = new ArrayList<EnrolleeDevice>();\r
-        mContext = null;\r
-\r
-    }\r
-\r
-    /**\r
-     * Gives a singleton instance of Easy setup service and initialize the service\r
-     *\r
-     * @param callback Application needs to provide this callback to receive the status of easy\r
-     *                 setup process.\r
-     */\r
-\r
-    public synchronized static EasySetupService getInstance(Context context, EasySetupStatus\r
-            callback) {\r
-        if (sInstance == null) {\r
-            sInstance = new EasySetupService(callback);\r
-            mContext = context;\r
-        }\r
-        return sInstance;\r
-    }\r
-\r
-    /**\r
-     * Reset the Easy setup Service\r
-     */\r
-\r
-    public void finish() {\r
-\r
-        //Native Api call to reset OIC stack\r
-        if (mProvisionEnrolleeInstance != null) {\r
-            mProvisionEnrolleeInstance.stopEnrolleeProvisioning(0);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Starts Easy setup process for the enrolling device.\r
-     *\r
-     * @param enrolledevice Device to be enrolled in network\r
-     * @throws IOException Throws exception in case of any connection error.\r
-     */\r
-\r
-    public synchronized void startSetup(final EnrolleeDevice enrolledevice) throws IOException {\r
-\r
-        mEnrolleeDeviceList.add(enrolledevice);\r
-\r
-        // Starts the provisioning directly if the device is already on boarded on the network.\r
-        if (enrolledevice.onBoarded()) {\r
-            enrolledevice.startProvisioning(mProvisioningCallback);\r
-            return;\r
-        }\r
-        enrolledevice.mState = EnrolleeState.DEVICE_ON_BOARDING_STATE;\r
-        mCallback.onProgress(enrolledevice);\r
-        enrolledevice.startOnBoarding(new OnBoardingCallback() {\r
-\r
-            @Override\r
-            public void onFinished(OnBoardingConnection connection) {\r
-                if (connection.isConnected()) {\r
-                    Log.i(TAG, "On boarding is successful ");\r
-                    // Start provisioning here\r
-                    enrolledevice.mState = EnrolleeState.DEVICE_ON_BOARDED_STATE;\r
-                    mCallback.onProgress(enrolledevice);\r
-                    enrolledevice.setConnection(connection);\r
-\r
-                    /* Delay is set according to Soft AP host and Mediator platform;\r
-                    *  For Android with Soft AP it is 2000 ms\r
-                    */\r
-                    delayProvisioning(connection);\r
-                    enrolledevice.startProvisioning(mProvisioningCallback);\r
-                } else {\r
-                    enrolledevice.mState = EnrolleeState.DEVICE_INIT_STATE;\r
-                    mProvisioningCallback.onFinished(enrolledevice);\r
-                }\r
-\r
-            }\r
-\r
-        });\r
-\r
-    }\r
-\r
-    /**\r
-     * Stops on-going Easy setup process for enrolling device.\r
-     *\r
-     * @param enrolleedevice Device to be enrolled in network\r
-     */\r
-    public synchronized void stopSetup(EnrolleeDevice enrolleedevice) {\r
-        if (mEnrolleeDeviceList.contains(enrolleedevice)) {\r
-            enrolleedevice.mState = EnrolleeState.DEVICE_INIT_STATE;\r
-            mCallback.onProgress(enrolleedevice);\r
-            if (enrolleedevice.mState == EnrolleeState.DEVICE_ON_BOARDING_STATE) {\r
-                Log.i(TAG, "stopOnBoardingProcess for enrolleedevice");\r
-                enrolleedevice.stopOnBoardingProcess();\r
-                mEnrolleeDeviceList.remove(enrolleedevice);\r
-            } else if (enrolleedevice.mState == EnrolleeState.DEVICE_PROVISIONING_STATE) {\r
-                Log.i(TAG, "stopOnBoardingProcess for enrolleedevice");\r
-                enrolleedevice.stopOnBoardingProcess();\r
-                Log.i(TAG, "stopEnrolleeProvisioning for enrolleedevice");\r
-                //Native Api call to stop on-going enrolling process for the enrolling device\r
-                EasySetupManager.getInstance().stopEnrolleeProvisioning(enrolleedevice\r
-                        .mOnBoardingConfig.getConnType().getValue());\r
-                mEnrolleeDeviceList.remove(enrolleedevice);\r
-\r
-            }\r
-        }\r
-    }\r
-\r
-    class ProvisioningCallbackImpl extends ProvisioningCallback {\r
-\r
-        private final EasySetupStatus mCallback;\r
-\r
-        ProvisioningCallbackImpl(EasySetupStatus callback) {\r
-            mCallback = callback;\r
-        }\r
-\r
-        @Override\r
-        public void onFinished(EnrolleeDevice enrolledevice) {\r
-            synchronized (EasySetupService.this) {\r
-                if (mEnrolleeDeviceList.contains(enrolledevice)) {\r
-                    Log.i(TAG, "onFinished() is received " + enrolledevice.isSetupSuccessful());\r
-                    mCallback.onFinished(enrolledevice);\r
-                    mEnrolleeDeviceList.remove(enrolledevice);\r
-                }\r
-            }\r
-        }\r
-\r
-        @Override\r
-        public void onProgress(EnrolleeDevice enrolledevice) {\r
-            mCallback.onProgress(enrolledevice);\r
-        }\r
-\r
-\r
-    }\r
-\r
-    private void delayProvisioning(OnBoardingConnection conn) {\r
-        if (((IpOnBoardingConnection)conn).getThrottlingDelay()>0) {\r
-            try {\r
-                Log.i(TAG, "waiting for 20 seconds to start provisioning");\r
-                Thread.sleep(20000);//Sleep for allowing thin device to start the services\r
-            } catch (InterruptedException e) {\r
-                e.printStackTrace();\r
-            }\r
-        }\r
-    }\r
-}
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupStatus.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetupStatus.java
deleted file mode 100755 (executable)
index b9da262..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-/**
- * This interface facilitates Application to get progress & result of Easy setup
- * process Easy setup process.
- */
-public interface EasySetupStatus {
-
-    /**
-     * This method is called back when easy setup process is finished. Easy
-     * setup process status can read from the APIs given in Enrollee class.This
-     * method is called on worker thread, UI operations to be executed on main /
-     * Ui Thread.
-     *
-     * @param enrolledevice Device to be enrolled in network through Easy setup process
-     */
-    public void onFinished(EnrolleeDevice enrolledevice);
-
-    /**
-     * This method is called back to give intermediate progress on the easy
-     * setup process This method is called on worker thread, UI operations to be
-     * executed on main / Ui Thread.
-     *
-     * @param enrolleeDevice Gives state of the device changed during easy setup process
-     */
-    public void onProgress(EnrolleeDevice enrolleeDevice);
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDevice.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDevice.java
deleted file mode 100755 (executable)
index 11d512c..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-/**\r
- * This is an abstract class represents the device being provisioned into the network. The\r
- * device being enrolled or provisioned into the network is called Enrollee.\r
- * Application has to extend this class and provide implementation of abstract methods according\r
- * to the ON-BOARDING & PROVISION connectivity i.e. WiFi etc.\r
- */\r
-\r
-public abstract class EnrolleeDevice {\r
-\r
-    protected EnrolleeState mState;\r
-    private EnrolleeSetupError mError;\r
-\r
-    protected OnBoardingConnection mConnection;\r
-    protected final ProvisioningConfig mProvConfig;\r
-    protected final OnBoardingConfig mOnBoardingConfig;\r
-\r
-    protected OnBoardingCallback mOnBoardingCallback;\r
-    protected ProvisioningCallback mProvisioningCallback;\r
-\r
-    /**\r
-     * @param onBoardingConfig Contains details about the connectivity to be established between\r
-     *                         the Enrollee device & Mediator device in order to perform\r
-     *                         on-boarding\r
-     * @param provConfig       Contains details about the network to which Enrollee device is\r
-     *                         going to connect.\r
-     */\r
-    protected EnrolleeDevice(OnBoardingConfig onBoardingConfig, ProvisioningConfig provConfig) {\r
-        mProvConfig = provConfig;\r
-        mOnBoardingConfig = onBoardingConfig;\r
-    }\r
-\r
-    /**\r
-     * Application has to implement it according to the on boarding connectivity the device is\r
-     * having.\r
-     * This method will be called back during the easy setup process.\r
-     */\r
-    protected abstract void startOnBoardingProcess();\r
-\r
-    /**\r
-     * This method is called back during the easy setup process if Application cancels the setup.\r
-     * Easy setup service checks the state of device and calls this function accordingly.\r
-     * Application has to provide implementation for this method to cancel the on boarding step.\r
-     */\r
-    protected abstract void stopOnBoardingProcess();\r
-\r
-    /**\r
-     * Application has to implement it according to the type of the network device is going to\r
-     * connect or provisioned.\r
-     * This method will be called back once on-boarding of the device is successful.\r
-     *\r
-     * @param conn Contains detail about the network established between the Enrollee device &\r
-     *             Mediator device. Its implementation vary according to the connectivity type.\r
-     */\r
-    protected abstract void startProvisioningProcess(OnBoardingConnection conn);\r
-\r
-    /**\r
-     * Once on boarding is successful concrete Enrollee class would call this method and set the\r
-     * Connection.\r
-     *\r
-     * @param conn Connectivity between Enrollee device & Mediator device.\r
-     */\r
-    protected void setConnection(OnBoardingConnection conn) {\r
-        mConnection = conn;\r
-    }\r
-\r
-    /**\r
-     * This method returns the OnBoardingConnection object depending on the connection type\r
-     *\r
-     * @return onBoardingConnection object\r
-     */\r
-    public OnBoardingConnection getConnection() {\r
-        return mConnection;\r
-    }\r
-\r
-\r
-    /**\r
-     * This method is called back by Easy setup service if on boarding needs to be done.\r
-     *\r
-     * @param onBoardingCallback This is called back once the on boarding is completed.\r
-     */\r
-    void startOnBoarding(OnBoardingCallback onBoardingCallback) {\r
-        mOnBoardingCallback = onBoardingCallback;\r
-        startOnBoardingProcess();\r
-    }\r
-\r
-    /**\r
-     * This method is called back by Easy setup service once on boarding is successful\r
-     *\r
-     * @param provisioningCallback This is called back once the provisioning process is completed\r
-     */\r
-    void startProvisioning(ProvisioningCallback provisioningCallback) {\r
-        mProvisioningCallback = provisioningCallback;\r
-        startProvisioningProcess(mConnection);\r
-    }\r
-\r
-    /**\r
-     * This method is used to check easy setup status\r
-     *\r
-     * @return true if successful or false\r
-     */\r
-\r
-    public boolean isSetupSuccessful() {\r
-        return (mState == EnrolleeState.DEVICE_PROVISIONED_STATE) ? true : false;\r
-    }\r
-\r
-    /**\r
-     * sets error occured during easy setup process\r
-     */\r
-    protected void setError(EnrolleeSetupError error) {\r
-        mError = error;\r
-    }\r
-\r
-    /**\r
-     * Returns error occured during easy setup process\r
-     *\r
-     * @return True EnrolleeSetupError object\r
-     */\r
-    public EnrolleeSetupError getError() {\r
-        return mError;\r
-    }\r
-\r
-    /**\r
-     * Gives the state of the device being enrolled during the easy setup process.\r
-     *\r
-     * @return Returns EnrolleeState object\r
-     */\r
-    public EnrolleeState getState() {\r
-        return mState;\r
-    }\r
-\r
-    /**\r
-     * This method is used to know if the device is on boarded or not\r
-     *\r
-     * @return True if on-boarded successfully or False\r
-     */\r
-\r
-    protected boolean onBoarded() {\r
-        return (mState == EnrolleeState.DEVICE_ON_BOARDED_STATE) ? true : false;\r
-    }\r
-\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactory.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceFactory.java
deleted file mode 100755 (executable)
index 9f62ca1..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * ***************************************************************
- * <p/>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p/>
- * <p/>
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-import android.content.Context;
-
-/**
- * This a factory class provides the native implementation of the various Enrollee devices.
- * Application can make use of Enrollee factory if it does not want to create its own Enrollee devices.
- */
-public class EnrolleeDeviceFactory {
-
-    Context mContext;
-
-    /**
-     * This method create & returns instance of EnrolleeDeviceFactory
-     *
-     * @param context This is Android Application context
-     */
-    public static EnrolleeDeviceFactory newInstance(Context context) {
-        return new EnrolleeDeviceFactory(context);
-    }
-
-    private EnrolleeDeviceFactory(Context context) {
-        mContext = context;
-    }
-
-    /**
-     * This method create & returns instance of Enrollee device of supported configuration
-     *
-     * @param onboardingConfig Contains details about the connectivity to be established between the Enrollee device & Mediator device in order to perform on-boarding
-     * @param provConfig       Contains details about the network to which Enrollee device is going to connect.
-     * @return Instance of the Enrollee device created natively.
-     */
-
-    public EnrolleeDevice newEnrolleeDevice(ProvisioningConfig provConfig, OnBoardingConfig onboardingConfig) {
-
-        if (onboardingConfig.getConnType() != OnBoardingConfig.ConnType.WiFi) {
-            throw new IllegalArgumentException("OnBoarding configuration is not supported");
-        }
-
-        return new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
-    }
-
-    /**
-     * This method create & returns instance of Enrollee device of supported configuration
-     * [When SoftAP is going to be created on Enrollee side]
-     *
-     * @param provConfig       Contains details about the network to which Enrollee device is going to connect.
-     * @return Instance of the Enrollee device created natively.
-     */
-    public EnrolleeDevice newEnrolleeDevice(ProvisioningConfig provConfig){
-        return new EnrolleeDeviceWiFiOnboarding(mContext, new IpOnBoardingConnection(true), provConfig);
-    }
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceWiFiOnboarding.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeDeviceWiFiOnboarding.java
deleted file mode 100755 (executable)
index fb50a0e..0000000
+++ /dev/null
@@ -1,179 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import java.util.Timer;\r
-import java.util.TimerTask;\r
-\r
-import org.iotivity.service.easysetup.core.EasySetupManager;\r
-import org.iotivity.service.easysetup.core.EnrolleeInfo;\r
-import org.iotivity.service.easysetup.core.IOnBoardingStatus;\r
-import org.iotivity.service.easysetup.core.IProvisioningListener;\r
-import org.iotivity.service.easysetup.core.ProvisionEnrollee;\r
-import org.iotivity.service.easysetup.core.ip.WiFiSoftAPManager;\r
-\r
-import android.content.Context;\r
-import android.net.wifi.WifiConfiguration;\r
-import android.util.Log;\r
-\r
-/**\r
- * This is a ready to use class for Enrollee device having Soft AP as on-boarding connectivity.\r
- */\r
-public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice {\r
-\r
-    public static final String TAG = EnrolleeDeviceWiFiOnboarding.class.getName();\r
-\r
-    final Context mContext;\r
-    final WiFiSoftAPManager mWifiSoftAPManager;\r
-    EnrolleeInfo connectedDevice;\r
-    private EasySetupManager easySetupManagerNativeInstance;\r
-    ProvisionEnrollee provisionEnrolleInstance;\r
-    Timer myTimer = null;\r
-\r
-    IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {\r
-\r
-        @Override\r
-        public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {\r
-            myTimer.cancel();\r
-            Log.d("ESSoftAPOnBoarding", "Entered");\r
-            if (mState == EnrolleeState.DEVICE_ON_BOARDING_STATE) {\r
-                Log.d("ESSoftAPOnBoarding", "Device in OnBoarding State");\r
-                if (enrolleStatus != null && enrolleStatus.getIpAddr() != null) {\r
-                    String finalResult = "Easy Connect : ";\r
-\r
-                    if (enrolleStatus.isReachable()) {\r
-                        finalResult = "Device OnBoarded" + "["\r
-                                + enrolleStatus.getIpAddr() + "]";\r
-\r
-                        connectedDevice = enrolleStatus;\r
-                        IpOnBoardingConnection conn = new IpOnBoardingConnection();\r
-\r
-                        conn.setConnectivity(true);\r
-                        conn.setIp(connectedDevice.getIpAddr());\r
-                        conn.setHardwareAddress(enrolleStatus.getHWAddr());\r
-                        conn.setDeviceName(enrolleStatus.getDevice());\r
-\r
-                        Log.d("ESSoftAPOnBoarding", "Entered" + finalResult);\r
-                        mOnBoardingCallback.onFinished(conn);\r
-                        return;\r
-\r
-                    }\r
-                }\r
-\r
-                IpOnBoardingConnection conn = new IpOnBoardingConnection();\r
-                conn.setConnectivity(false);\r
-                mOnBoardingCallback.onFinished(conn);\r
-            } else {\r
-                Log.e("ESSoftAPOnBoarding", "Device NOT in OnBoarding State. Ignoring the event");\r
-            }\r
-        }\r
-    };\r
-\r
-\r
-    protected EnrolleeDeviceWiFiOnboarding(Context context, OnBoardingConfig onBoardingConfig,\r
-                                           ProvisioningConfig provConfig) {\r
-        super(onBoardingConfig, provConfig);\r
-        mContext = context;\r
-        mWifiSoftAPManager = new WiFiSoftAPManager(mContext);\r
-    }\r
-\r
-    protected EnrolleeDeviceWiFiOnboarding(Context context, IpOnBoardingConnection conn,\r
-                                           ProvisioningConfig provConfig) {\r
-        super(new WiFiOnBoardingConfig(), provConfig);\r
-        mContext = context;\r
-        mConnection = conn;\r
-        mState = EnrolleeState.DEVICE_ON_BOARDED_STATE;\r
-        mWifiSoftAPManager = new WiFiSoftAPManager(mContext);\r
-    }\r
-\r
-    @Override\r
-    protected void startOnBoardingProcess() {\r
-        Log.i(TAG, "Starting on boarding process");\r
-\r
-        //1. Create Soft AP\r
-        boolean status = mWifiSoftAPManager.setWifiApEnabled((WifiConfiguration)\r
-                mOnBoardingConfig.getConfig(), true);\r
-\r
-        mState = EnrolleeState.DEVICE_ON_BOARDING_STATE;\r
-\r
-        Log.i(TAG, "Soft AP is created with status " + status);\r
-\r
-        myTimer = new Timer();\r
-        myTimer.schedule(new TimerTask() {\r
-            @Override\r
-            public void run() {\r
-                // Below function to be called after 5 seconds\r
-                mWifiSoftAPManager.getClientList(deviceScanListener, 300);\r
-            }\r
-\r
-        }, 0, 5000);\r
-    }\r
-\r
-    protected void stopOnBoardingProcess() {\r
-        Log.i(TAG, "Stopping on boarding process");\r
-        if(myTimer != null)\r
-        {\r
-            myTimer.cancel();\r
-        }\r
-        boolean status = mWifiSoftAPManager.setWifiApEnabled(null, false);\r
-        Log.i(TAG, "Soft AP is disabled with status " + status);\r
-    }\r
-\r
-    @Override\r
-    protected void startProvisioningProcess(OnBoardingConnection conn) {\r
-\r
-        mState = EnrolleeState.DEVICE_PROVISIONING_STATE;\r
-        mProvisioningCallback.onProgress(this);\r
-        final EnrolleeDevice device = this;\r
-        if (mProvConfig.getConnType() == ProvisioningConfig.ConnType.WiFi) {\r
-\r
-            provisionEnrolleInstance = new ProvisionEnrollee(mContext);\r
-\r
-            provisionEnrolleInstance.registerProvisioningHandler(new IProvisioningListener() {\r
-                @Override\r
-                public void onFinishProvisioning(int statuscode) {\r
-\r
-                    Log.i(TAG, "Provisioning is finished with status code " + statuscode);\r
-                    mState = (statuscode == 0) ? EnrolleeState.DEVICE_PROVISIONED_STATE\r
-                            : EnrolleeState.DEVICE_INIT_STATE;\r
-                    stopOnBoardingProcess();\r
-                    mProvisioningCallback.onProgress(device);\r
-                    mProvisioningCallback.onFinished(EnrolleeDeviceWiFiOnboarding.this);\r
-                }\r
-            });\r
-\r
-            IpOnBoardingConnection connection = (IpOnBoardingConnection) conn;\r
-            WiFiProvConfig wifiProvConfig = (WiFiProvConfig) mProvConfig;\r
-\r
-            easySetupManagerNativeInstance = EasySetupManager.getInstance();\r
-            easySetupManagerNativeInstance.setApplicationContext(mContext);\r
-            easySetupManagerNativeInstance.initEasySetup();\r
-\r
-            // Native Api call to start provisioning of the enrolling device\r
-            easySetupManagerNativeInstance.provisionEnrollee(connection.getIp(), wifiProvConfig\r
-                    .getSsId(), wifiProvConfig.getPassword(), 1);\r
-        }\r
-    }\r
-\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeSetupError.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeSetupError.java
deleted file mode 100755 (executable)
index 036d24d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-/**
- * This class defines constants for Errors comes during Easy setup process
- */
-public enum EnrolleeSetupError {
-    /**
-     * Device setup successful
-     */
-    DEVICE_SETUP_SUCCESSFUL,
-    /**
-     * Device setup failed
-     */
-    DEVICE_SETUP_FAILED,
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeState.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeState.java
deleted file mode 100755 (executable)
index 7dcf602..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-/**
- * It defines various states of the Enrollee device during easy setup process
- */
-
-public enum EnrolleeState {
-
-    /**
-     * Default state of the device
-     */
-    DEVICE_INIT_STATE,
-
-    /**
-     * Device will move to this state after successful on-boarding of the device
-     */
-    DEVICE_ON_BOARDED_STATE,
-
-    /**
-     * Device will move to this state once the on boarding begins
-     */
-    DEVICE_ON_BOARDING_STATE,
-
-    /**
-     * Device will move to this state once the on boarding is done
-     */
-    DEVICE_PROVISIONING_STATE,
-
-    /**
-     * Easy setup process is successful.
-     */
-    DEVICE_PROVISIONED_STATE,
-
-    /**
-     * This state is arbitrary one, any time device can come into this state
-     * Device will move to this state if the ownership transfer initiated  by the Application
-     */
-    DEVICE_OWNERSHIP_TRANSFERRING_STATE,
-
-    /**
-     * This state is arbitrary one, any time device can come into this state
-     * Device will move to this state if the ownership transfer is completed
-     */
-    DEVICE_OWNERSHIP_TRANSFERRED_STATE,
-
-
-    /**
-     * This state is arbitrary one, any time device can come into this state
-     * Device will move to this state once the Application factory reset the device
-     */
-    DEVICE_FACTORY_RESET_STATE,
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IpOnBoardingConnection.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IpOnBoardingConnection.java
deleted file mode 100755 (executable)
index 8d4971f..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-public class IpOnBoardingConnection implements OnBoardingConnection {\r
-\r
-    private boolean mIsConnected;\r
-    private String mIp;\r
-    private String mHardwareAddress;\r
-    private String mDeviceName;\r
-\r
-    /**\r
-     * @mThrottlingDelay\r
-     * After creating the Soft AP at Mediator & on-boarding the-\r
-     * -Enrollee device on it provisioning needs to be delayed by at least 2000 ms for Android Mediator\r
-     */\r
-    private int mThrottlingDelay = 2000 ;\r
-\r
-    int getThrottlingDelay() {\r
-        return mThrottlingDelay;\r
-    }\r
-\r
-    IpOnBoardingConnection(boolean enrolleeOnboarded) {\r
-        mThrottlingDelay = 0;\r
-        mIp = "0.0.0.01";\r
-        mIsConnected = enrolleeOnboarded; // Always true for this constructor\r
-    }\r
-\r
-    IpOnBoardingConnection(){}\r
-\r
-    public void setHardwareAddress(String address) {\r
-        mHardwareAddress = address;\r
-    }\r
-\r
-    public String getHardwareAddress() {\r
-        return mHardwareAddress;\r
-    }\r
-\r
-    public void setDeviceName(String name) {\r
-        mDeviceName = name;\r
-    }\r
-\r
-    public String getDeviceName() {\r
-        return mDeviceName;\r
-    }\r
-\r
-    public void setConnectivity(boolean connected) {\r
-        mIsConnected = connected;\r
-    }\r
-\r
-    public void setIp(String ip) {\r
-        mIp = ip;\r
-    }\r
-\r
-    public String getIp() {\r
-        return mIp;\r
-    }\r
-\r
-    @Override\r
-    public String getDesc() {\r
-        return "Description";\r
-    }\r
-\r
-    @Override\r
-    public boolean isConnected() {\r
-        return mIsConnected;\r
-    }\r
-\r
-    @Override\r
-    public Object getConnection() {\r
-        return this;\r
-    }\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConfig.java
deleted file mode 100755 (executable)
index 6aacce9..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import org.iotivity.base.OcConnectivityType;\r
-\r
-/**\r
- * It contains configuration details about the connectivity type between the Enrollee device &\r
- * Mediator device in order to perform on-boarding.\r
- */\r
-\r
-public interface OnBoardingConfig {\r
-\r
-    /**\r
-     * It provides constants for connectivity types used for on-boarding Enrollee device\r
-     */\r
-    public static enum ConnType {\r
-        // Note : Enum Ids should matched with Native Ids\r
-        WiFi(OcConnectivityType.CT_DEFAULT.getValue()),\r
-        BLE(OcConnectivityType.CT_ADAPTER_GATT_BTLE.getValue());\r
-\r
-        private int mConnType;\r
-\r
-        ConnType(int connType) {\r
-            mConnType = connType;\r
-        }\r
-\r
-        public int getValue() {\r
-            return mConnType;\r
-        }\r
-\r
-    }\r
-\r
-    /**\r
-     * Gives configuration object specific to the on-boarding connectivity of the enrolling device.\r
-     *\r
-     * @return instance object of configuration according to connectivity type\r
-     */\r
-    public Object getConfig();\r
-\r
-    /**\r
-     * Gives connectivity type of on-boarding device\r
-     *\r
-     * @return on-boarding connectivity type\r
-     */\r
-    public ConnType getConnType();\r
-\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConnection.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/OnBoardingConnection.java
deleted file mode 100755 (executable)
index 622c693..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-/**\r
- * This interface contains the connection details of the enrollee device\r
- */\r
-public interface OnBoardingConnection {\r
-\r
-    /**\r
-     * This method returns the implementation of the Connection\r
-     *\r
-     * @return implementation\r
-     */\r
-    public Object getConnection();\r
-\r
-    /**\r
-     * This method returns description on the connectivity.\r
-     *\r
-     * @return description\r
-     */\r
-    public String getDesc();\r
-\r
-    /**\r
-     * This method is used to know if the device is connected or not\r
-     *\r
-     * @return True if connected or False\r
-     */\r
-    public boolean isConnected();\r
-\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningCallback.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningCallback.java
deleted file mode 100755 (executable)
index 569f6fe..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-public abstract class ProvisioningCallback {
-    public abstract void onFinished(EnrolleeDevice enrolledevice);
-    public abstract void onProgress(EnrolleeDevice enrolledevice);
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ProvisioningConfig.java
deleted file mode 100755 (executable)
index 4c15217..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-/**
- * It contains configuration details about the the target network where Enrollee device is
- * going to be enrolled.
- */
-public interface ProvisioningConfig {
-
-    /**
-     * It provides constants for connectivity types of target network
-     */
-    public static enum ConnType {
-        WiFi,
-        BT
-    }
-
-    /**
-     * Gives the instance of the configuration object created according to the connectivity
-     * type of target network.
-     *
-     * @return instance object of configuration according to connectivity type of target network
-     */
-    Object getConfig();
-
-
-    /**
-     * Gives connectivity type of target network
-     *
-     * @return Connectivity type of target network
-     */
-    ConnType getConnType();
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiOnBoardingConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiOnBoardingConfig.java
deleted file mode 100755 (executable)
index 2477938..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/**\r
- * ***************************************************************\r
- * <p/>\r
- * Copyright 2015 Samsung Electronics All Rights Reserved.\r
- * <p/>\r
- * <p/>\r
- * <p/>\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * <p/>\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * <p/>\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * <p/>\r
- * ****************************************************************\r
- */\r
-\r
-package org.iotivity.service.easysetup.mediator;\r
-\r
-import org.iotivity.service.easysetup.mediator.OnBoardingConfig;\r
-\r
-import android.net.wifi.WifiConfiguration;\r
-\r
-/**\r
- * This class contains on boarding configuration information for Soft AP on boarding connectivity.\r
- * It implements OnBoardingConfig interface & provide implementation for WiFi Soft AP connectivity.\r
- */\r
-\r
-public class WiFiOnBoardingConfig implements OnBoardingConfig {\r
-\r
-    private final WifiConfiguration config = new WifiConfiguration();\r
-    private final ConnType mConnType = OnBoardingConfig.ConnType.WiFi;\r
-\r
-    @Override\r
-    public Object getConfig() {\r
-        return config;\r
-    }\r
-\r
-    public void setSSId(String ssid) {\r
-        config.SSID = ssid;\r
-    }\r
-\r
-    public void setSharedKey(String sharedKey) {\r
-        config.preSharedKey = sharedKey;\r
-    }\r
-\r
-    public void setAuthAlgo(int aurthAlgo) {\r
-        config.allowedAuthAlgorithms.set(aurthAlgo);\r
-    }\r
-\r
-    public void setKms(int kms) {\r
-        config.allowedKeyManagement.set(kms);\r
-    }\r
-\r
-    @Override\r
-    public ConnType getConnType() {\r
-        return mConnType;\r
-    }\r
-}\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiProvConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/WiFiProvConfig.java
deleted file mode 100755 (executable)
index c7e6359..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * ***************************************************************
- * <p>
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
- * 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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.
- * <p>
- * ****************************************************************
- */
-
-package org.iotivity.service.easysetup.mediator;
-
-import org.iotivity.service.easysetup.mediator.ProvisioningConfig;
-
-/**
- * This class contains on provisioning configuration information for for target network.
- * It implements ProvisioningConfig interface and provide configuration object specific to WiFi target network
- */
-public class WiFiProvConfig implements ProvisioningConfig {
-
-    private final ConnType mConnType = ProvisioningConfig.ConnType.WiFi;
-
-    private final String mSsId;
-    private final String mPassword;
-
-    public WiFiProvConfig(String ssid, String pass) {
-        mSsId = ssid;
-        mPassword = pass;
-    }
-
-    @Override
-    public Object getConfig() {
-        return this;
-    }
-
-    @Override
-    public ConnType getConnType() {
-        return mConnType;
-    }
-
-    /**
-     * This method returns the SSID of the Target WIFI network
-     * @return SSID of Target Network
-     */
-    public String getSsId() {
-        return mSsId;
-    }
-
-    /**
-     * This method returns the password of the Target WIFI network
-     * @return password of Target Network
-     */
-    public String getPassword() {
-        return mPassword;
-    }
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/main.iml b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/main.iml
deleted file mode 100644 (file)
index 80242f3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="android" name="Android">
-      <configuration />
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
-    </content>
-    <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="classes1" level="project" />
-  </component>
-</module>
\ No newline at end of file
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644 (file)
index 288b665..0000000
Binary files a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/strings.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/strings.xml
deleted file mode 100644 (file)
index 830c7cd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-
-    <string name="app_name">EasySetupCore</string>
-
-</resources>
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/styles.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/res/values/styles.xml
deleted file mode 100644 (file)
index 6ce89c7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
diff --git a/service/easy-setup/sdk/mediator/android/jni/Application.mk b/service/easy-setup/sdk/mediator/android/jni/Application.mk
deleted file mode 100644 (file)
index d5fc03c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-APP_STL               := gnustl_shared
-APP_PLATFORM = android-21
-NDK_TOOLCHAIN_VERSION := 4.8
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp b/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp
deleted file mode 100644 (file)
index 16386c0..0000000
+++ /dev/null
@@ -1,191 +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 "jni_easy_setup.h"
-
-#include "jni_easy_setup_jvm.h"
-#include "prov_adapter.h"
-
-void JNIProvisioningStatusCallback(ProvisioningInfo * provInfo) {
-       JNIEnv *env = EasySetupJVM::getEnv();
-       if (env == NULL) {
-               LOGE("JNIProvisioningStatusCallback : Getting JNIEnv failed");
-               return;
-       }
-
-       // Get EasySetupHandler class reference
-       jclass easysetupCallbacks = GetJClass(
-                       EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
-       if (NULL == easysetupCallbacks) {
-               LOGE(
-                               "JNIProvisioningStatusCallback : GetJClass easysetupCallbacks failed");
-               EasySetupJVM::releaseEnv();
-               return;
-       }
-
-       // Get the easysetupCallback class instance
-       jobject jobjectCallback = GetJObjectInstance(
-                       EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
-       if (NULL == jobjectCallback) {
-               LOGE("getInstance( %s) failed!",
-                               EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH);
-               EasySetupJVM::releaseEnv();
-               return;
-       }
-
-       // Get onResourceCallback method reference
-       jmethodID method_id = env->GetMethodID(easysetupCallbacks,
-                       "ProvisioningStatusCallBack",
-                       METHOD_PROVISIONING_STATUS_INTEGER_CALLBACK);
-       if (NULL == method_id) {
-               LOGE(
-                               "JNIProvisioningStatusCallback: onResourceCallback : GetMethodID failed");
-               EasySetupJVM::releaseEnv();
-               return;
-       }
-
-       if ((env)->ExceptionCheck()) {
-               LOGE("JNIProvisioningStatusCallback : ExceptionCheck failed");
-               EasySetupJVM::releaseEnv();
-               return;
-       }
-
-       if (NULL == method_id) {
-               LOGI("JNI method_id is NULL");
-       } else {
-               LOGI("JNI method_id is VALID");
-
-               jint result;
-               if (provInfo->provStatus == DEVICE_PROVISIONED) {
-                       result = 0;
-               } else {
-                       result = -1;
-               }
-
-               env->CallVoidMethod(jobjectCallback, method_id, (jint) result);
-       }
-
-       EasySetupJVM::releaseEnv();
-}
-
-JNIEXPORT void JNICALL
-JNIInitEasySetup(JNIEnv
-               *env,
-               jobject thisObj
-)
-{
-       LOGI("JNI JNIInitEasySetup: Enter");
-
-       InitProvProcess();
-
-       RegisterCallback(JNIProvisioningStatusCallback);
-}
-
-JNIEXPORT void JNICALL
-JNITerminateEasySetup(JNIEnv
-               *env,
-               jobject thisObj
-)
-{
-       LOGI("JNI JNITerminateEasySetup: Enter");
-
-       ResetProvProcess();
-
-}
-
-JNIEXPORT void JNICALL
-JNIProvisionEnrollee(JNIEnv
-               *env,
-               jobject thisObj,
-               jstring
-               jIPAddress,
-               jstring jNetSSID,
-               jstring
-               jNetPWD,
-               jint jConnectivityType
-)
-{
-       LOGI("JNI JNIProvisionEnrollee: Enter");
-
-       if (!jIPAddress)
-       {
-               LOGE("JNI JNIProvisionEnrollee : jIPAddress is NULL!");
-               return;
-       }
-
-       const char *ipAddress = env->GetStringUTFChars(jIPAddress, NULL);
-       if (NULL == ipAddress)
-       {
-               LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-       }
-
-       LOGI("JNI JNIProvisionEnrollee : ipAddress is : %s",ipAddress);
-
-       const char *netSSID = env->GetStringUTFChars(jNetSSID, NULL);
-       if (NULL == netSSID)
-       {
-               LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-       }
-
-       LOGI("JNI JNIProvisionEnrollee : netSSID is : %s",netSSID);
-
-       const char *netPWD = env->GetStringUTFChars(jNetPWD, NULL);
-       if (NULL == netPWD)
-       {
-               LOGE("JNI JNIProvisionEnrollee : Failed to convert jstring to char string!");
-       }
-
-       LOGI("JNI JNIProvisionEnrollee : netPWD is : %s",netPWD);
-
-       OCConnectivityType connecitivityType;
-       EnrolleeNWProvInfo netInfo =
-       {       0};
-       strncpy(netInfo
-                       .netAddressInfo.WIFI.ipAddress, ipAddress, IPV4_ADDR_SIZE-1);
-       strncpy(netInfo
-                       .netAddressInfo.WIFI.ssid, netSSID, NET_WIFI_SSID_SIZE-1);
-       strncpy(netInfo
-                       .netAddressInfo.WIFI.pwd, netPWD, NET_WIFI_PWD_SIZE-1);
-       netInfo.
-       connType = (OCConnectivityType) jConnectivityType;
-
-       netInfo.
-       isSecured = true;
-
-       StartProvisioning(&netInfo);
-
-       return;
-}
-
-JNIEXPORT void JNICALL
-JNIStopEnrolleeProvisioning(JNIEnv
-               *env,
-               jobject thisObj,
-               jint
-               jConnectivityType)
-{
-       LOGI("JNI Stop Easy Setup: Entering");
-
-       StopProvisioning((OCConnectivityType)
-                       jConnectivityType);
-
-       return;
-}
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h b/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h
deleted file mode 100644 (file)
index a69d657..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-#include <jni.h>\r
-#include <jni_string.h>\r
-\r
-#include "JniOcStack.h"\r
-\r
-#define METHOD_PROVISIONING_STATUS_VOID_CALLBACK    "("")V"\r
-#define METHOD_PROVISIONING_STATUS_INTEGER_CALLBACK    "("EASY_SETUP_JAVA_INTEGER_TYPE")V"\r
-\r
-/* Header for class org_iotivity_service_easyconnect_java_EasySetupHandler */\r
-\r
-#ifndef _Included_org_iotivity_service_easysetup_java_EasySetupHandler\r
-#define _Included_org_iotivity_service_easysetup_java_EasySetupHandler\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-JNIEXPORT void JNICALL JNIInitEasySetup(JNIEnv *env, jobject thisObj);\r
-JNIEXPORT void JNICALL JNITerminateEasySetup(JNIEnv *env, jobject thisObj);\r
-\r
-/*\r
- * Class:     org_iotivity_service_easyconnect_java_EasySetupHandler\r
- * Method:    JNIProvisionEnrollee\r
- * Signature: ()V\r
- */\r
-JNIEXPORT void JNICALL JNIProvisionEnrollee(JNIEnv *env, jobject ,\r
-                                                jstring ,\r
-                                                jstring ,\r
-                                                jstring ,\r
-                                                jint jConnectivityType);\r
-\r
-JNIEXPORT void JNICALL JNIStopEnrolleeProvisioning(JNIEnv *, jobject, jint);\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif\r
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h
deleted file mode 100755 (executable)
index 5997851..0000000
+++ /dev/null
@@ -1,94 +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   jni_easy_setup_jvm.h
- *
- * @brief  This file contains the essential declarations and functions required
- *            for JNI implementation
- */
-
-#ifndef __JNI_EASY_SETUP_JVM_H_
-#define __JNI_EASY_SETUP_JVM_H_
-
-#include <jni.h>
-#include <thread>
-#include <mutex>
-
-#define EASY_SETUP_SERVICE_NATIVE_API_CLASS_PATH    "org/iotivity/service/easysetup/core/EasySetupManager"
-#define EASY_SETUP_SERVICE_NATIVE_API_CLASS_TYPE    "Lorg/iotivity/service/easysetup/core/EasySetupManager;"
-#define EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH    "org/iotivity/service/easysetup/core/EasySetupCallbackHandler"
-#define EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_TYPE    "Lorg/iotivity/service/easysetup/core/EasySetupCallbackHandler;"
-
-#define EASY_SETUP_JAVA_STRING_TYPE "Ljava/lang/String;"
-#define EASY_SETUP_JAVA_INTEGER_TYPE "I"
-
-/**
- * @class   EasySetupJVM
- * @brief   This class provides functions related to JNI Environment.
- *
- */
-class EasySetupJVM {
-public:
-    /**
-     * @brief destructor
-     */
-    ~EasySetupJVM() {
-    }
-    ;
-
-    /**
-     * @brief  Get JVM instance
-     */
-    static JNIEnv *getEnv();
-
-    /**
-     * @brief  Release aquired JVM instance
-     */
-    static void releaseEnv();
-
-public:
-    /**
-     *  Java VM pointer
-     */
-    static JavaVM *m_jvm;
-
-private:
-    /**
-     * @brief constructor
-     */
-    EasySetupJVM();
-
-    /**
-     *  Mutex for thread synchronization
-     */
-    static std::mutex m_currentThreadMutex;
-};
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-jclass GetJClass(const char *szClassPath);
-jobject GetJObjectInstance(const char *szClassPath);
-#ifdef __cplusplus
-}
-#endif
-#endif //__JNI_EASY_SETUP_JVM_H_
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h
deleted file mode 100644 (file)
index fe92a82..0000000
+++ /dev/null
@@ -1,111 +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   jni_getter.h
- *
- * @brief  This file contains the JGetter class  declarations and its functions required
- *            for getting and setting basic data types in C++ and Java
- */
-
-#ifndef __JNI_GETTER_H_
-#define __JNI_GETTER_H_
-
-#include <string>
-#include <jni.h>
-
-/**
- * @class   JGetter
- * @brief  This class provide utility for get/set basic data types in C++ and Java
- *
- */
-class JGetter {
-public:
-       /**
-        * This function is called to get String field from the C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject from which string field is expected
-        * @param fieldName
-        *           Name of the field to be extracted from JObject
-        * @param value
-        *         reference to string value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool getJStringField(JNIEnv *env, jobject &object,
-                       const char *fieldName, std::string &value);
-
-       /**
-        * This function is called to get Boolean field from the C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject from which boolean field is expected
-        * @param fieldName
-        *           Name of the field to be extracted from JObject
-        * @param value
-        *         reference to boolean value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool getJBoolField(JNIEnv *env, jobject &object,
-                       const char *fieldName, bool &value);
-
-       /**
-        * This function is called to get Integer field from the C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject from which integer field is expected
-        * @param fieldName
-        *           Name of the field to be extracted from JObject
-        * @param value
-        *         reference to integer value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool getJIntField(JNIEnv *env, jobject &object,
-                       const char *fieldName, int &value);
-
-       /**
-        * This function is called to get Object reference from the C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject from which Object reference is expected
-        * @param fieldName
-        *           Name of the field to be extracted from JObject
-        * @param fieldType
-        *           Type of the field to be extracted from JObject
-        * @param value
-        *         reference to Object reference mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool getJObjectField(JNIEnv *env, jobject &object,
-                       const char *fieldName, const char *fieldType, jobject &value);
-};
-#endif //__JNI_GETTER_H_
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h
deleted file mode 100644 (file)
index 5f27a47..0000000
+++ /dev/null
@@ -1,96 +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   jni_object.h
- *
- * @brief  This file contains the JObject class  declarations and its functions required
- *            for getting and setting basic data types in C++ and Java
- */
-
-#ifndef __JNI_OBJECT_H_
-#define __JNI_OBJECT_H_
-
-#include <jni.h>
-#include "JniOcResource.h"
-
-/**
- * @class   JObject
- * @brief   This class provides a set of functions for JNI object.
- *
- */
-class JObject {
-public:
-       /**
-        * @brief constructor
-        */
-       JObject(JNIEnv *env);
-
-       /**
-        * @brief constructor
-        */
-       JObject(JNIEnv *env, jobject obj);
-
-       /**
-        * @brief constructor
-        */
-       JObject(JNIEnv *env, const char *classPath);
-
-       /**
-        * @brief destructor
-        *
-        */
-       virtual ~JObject();
-
-       /**
-        * Function to get the jobject.
-        *
-        * @return jobject, returns a new JNI object or NULL otherwise.
-        *
-        */
-       virtual jobject getObject() const;
-
-       /**
-        * Function to detach the jobject.
-        *
-        * @return void
-        *
-        */
-       void detachObject();
-
-protected:
-       /**
-        *  JNI Environment Pointer
-        */
-       JNIEnv *m_pEnv;
-       /**
-        *  Java Object
-        */
-       jobject m_pObject;
-       /**
-        *  Java Class
-        */
-       jclass m_pClazz;
-       /**
-        *  Boolean variable to check if an object is new
-        */
-       bool m_fIsNewObject;
-};
-#endif //__JNI_OBJECT_H_
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h
deleted file mode 100644 (file)
index c4593cc..0000000
+++ /dev/null
@@ -1,128 +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   jni_setter.h
- *
- * @brief  This file contains the JSetter class declarations and and its functions required
- *            to set data types in C++ object from Java object
- */
-
-#ifndef __JNI_SETTER_H_
-#define __JNI_SETTER_H_
-
-#include <jni.h>
-
-/**
- * @class   JSetter
- * @brief  This class provide utility to set data types in C++ object from Java object
- *
- */
-class JSetter {
-public:
-
-       /**
-        * This function is called to set Integer field in to C++ object.
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject to which integer field will be set.
-        * @param fieldName
-        *           Name of the field to be set in JObject
-        * @param value
-        *         integer value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool setJIntField(JNIEnv *env, jobject &object,
-                       const char *fieldName, int value);
-
-       /**
-        * This function is called to set Long field in to C++ object.
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject to which Long field will be set.
-        * @param fieldName
-        *           Name of the field to be set in JObject
-        * @param value
-        *         Long value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool setJLongField(JNIEnv *env, jobject &object,
-                       const char *fieldName, jlong value);
-
-       /**
-        * This function is called to Set Boolean field to C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject to which boolean field has to be set
-        * @param fieldName
-        *           Name of the field to be set in JObject
-        * @param value
-        *         boolean value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool setJBoolField(JNIEnv *env, jobject &object,
-                       const char *fieldName, bool value);
-       /**
-        * This function is called to Set String field from the C++ object
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject in which string value has to be set
-        * @param fieldName
-        *           Name of the field to be set in JObject
-        * @param value
-        *         string value mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool setJStringField(JNIEnv *env, jobject &object,
-                       const char *fieldName, const char *value);
-
-       /**
-        * This function is called to set Object reference in C++ object.
-        *
-        * @param env
-        *           JNI Environment reference
-        * @param object
-        *           JObject to which Object reference is to be set.
-        * @param fieldName
-        *           Name of the field to be set in JObject
-        * @param fieldType
-        *           Type of the field to be set in JObject
-        * @param value
-        *         value of Object mentioned in fieldName
-        *
-        * @return returns true on success and false on failer.
-        */
-       static bool setJObjectField(JNIEnv *env, jobject &object,
-                       const char *fieldName, const char *fieldType, const jobject value);
-};
-
-#endif //__JNI_SETTER_H_
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h
deleted file mode 100644 (file)
index 358e869..0000000
+++ /dev/null
@@ -1,80 +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   jni_string.h
- *
- * @brief  This file contains the declaration of JString class and its members related to JString.
- *
- */
-
-#ifndef __JNI_STRING_H_
-#define __JNI_STRING_H_
-
-#include <string>
-
-#include "jni_object.h"
-
-/**
- * @class   JString
- * @brief   This class inherits JObject class and provides a set of functions for JNI String.
- *
- */
-class JString: public JObject {
-public:
-       /**
-        * @brief constructor
-        */
-       JString(JNIEnv *env, jstring value);
-       /**
-        * @brief constructor
-        */
-       JString(JNIEnv *env, const char *value);
-       /**
-        * @brief constructor
-        */
-       JString(JNIEnv *env, const std::string &value);
-       /**
-        * @brief destructor
-        */
-       ~JString();
-
-       /**
-        * Function to get the string value and set it.
-        *
-        * @param value - String value to set to a private member variable.
-        *
-        * @return bool - true on success
-        *
-        */
-       bool getValue(std::string &value);
-
-       /**
-        * Function to get the private string value.
-        *
-        * @return  C String value.
-        *
-        */
-       const char *c_str();
-
-private:
-       std::string m_cstr;
-};
-#endif //__JNI_STRING_H_
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp
deleted file mode 100644 (file)
index 6c33f95..0000000
+++ /dev/null
@@ -1,319 +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 "jni_easy_setup_jvm.h"
-#include <string>
-#include "jni_easy_setup.h"
-
-/**
- * @class   JClassMap
- * @brief   This class provides functions for initializing the Java class path and Java class.
- *
- */
-class JClassMap {
-public:
-    /**
-     *  Java Class
-     */
-    jclass classRef;
-    /**
-     *  Java Class Path
-     */
-    const char *szClassPath;
-
-    /**
-     * @brief constructor
-     */
-    JClassMap(const char *path) :
-            classRef(NULL) {
-        szClassPath = path;
-    }
-};
-
-/**
- * @class   JObjectMap
- * @brief   This class provides functins for initializing the Java Class path and Java Class
- * Object.
- *
- */
-class JObjectMap {
-public:
-    /**
-     *  Java Object
-     */
-    jobject object;
-    /**
-     *  Java Class Path
-     */
-    const char *szClassPath;
-
-    /**
-     * @brief constructor
-     */
-    JObjectMap(const char *path) :
-            object(NULL) {
-        szClassPath = path;
-    }
-};
-
-static JClassMap gJClassMapArray[] = { JClassMap(
-        EASY_SETUP_SERVICE_NATIVE_API_CLASS_PATH), JClassMap(
-        EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH) };
-
-static JObjectMap gJObjectMapArray[] = { JObjectMap(
-        EASY_SETUP_SERVICE_CALLBACK_NATIVE_API_CLASS_PATH) };
-
-static JNINativeMethod gEasySetupMethodTable[] = {
-    { "InitEasySetup", "()V", (void *) JNIInitEasySetup },
-    { "TerminateEasySetup", "()V", (void *) JNITerminateEasySetup },
-    { "ProvisionEnrollee", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V",
-                                (void *) JNIProvisionEnrollee },
-    { "StopEnrolleeProvisioning", "(I)V", (void *) JNIStopEnrolleeProvisioning }, };
-
-static int gEasySetupMethodTableSize = sizeof(gEasySetupMethodTable)
-        / sizeof(gEasySetupMethodTable[0]);
-
-int InitializeJClassMapArray(JNIEnv *env) {
-    LOGI("InitializeJClassMapArray: Enter");
-
-    unsigned int nLen = sizeof(gJClassMapArray) / sizeof(JClassMap);
-
-    for (unsigned int i = 0; i < nLen; i++) {
-        jclass classRef = env->FindClass(gJClassMapArray[i].szClassPath);
-        if (NULL == classRef) {
-            LOGE("FindClass failed for [%s]", gJClassMapArray[i].szClassPath);
-            return -1;
-        }
-        gJClassMapArray[i].classRef = (jclass) env->NewGlobalRef(classRef);
-        env->DeleteLocalRef(classRef);
-    }
-
-    LOGI("InitializeJClassMapArray: Exit");
-    return 0;
-}
-
-jclass GetJClass(const char *szClassPath) {
-    unsigned int nLen = sizeof(gJClassMapArray) / sizeof(JClassMap);
-
-    jclass classRef = NULL;
-
-    for (unsigned int i = 0; i < nLen; i++) {
-        if (0 == strcmp(gJClassMapArray[i].szClassPath, szClassPath)) {
-            classRef = gJClassMapArray[i].classRef;
-            break;
-        }
-    }
-
-    return classRef;
-}
-
-void DeleteClassMapArray(JNIEnv *env) {
-    LOGI("DeleteClassMapArray: Enter");
-
-    unsigned int nLen = sizeof(gJClassMapArray) / sizeof(JClassMap);
-    for (unsigned int i = 0; i < nLen; i++) {
-        if (NULL != gJClassMapArray[i].classRef) {
-            env->DeleteGlobalRef(gJClassMapArray[i].classRef);
-            gJClassMapArray[i].classRef = NULL;
-        }
-    }
-
-    LOGI("DeleteClassMapArray: Exit");
-}
-
-int InitializeJObjectMapArray(JNIEnv *env) {
-    LOGI("InitializeJObjectMapArray: Enter");
-
-    unsigned int nLen = sizeof(gJObjectMapArray) / sizeof(JObjectMap);
-
-    for (unsigned int i = 0; i < nLen; i++) {
-        jclass classRef = env->FindClass(gJObjectMapArray[i].szClassPath);
-        if (NULL == classRef) {
-            LOGE("InitializeJObjectMapArray: FindClass failed for [%s]",
-                    gJObjectMapArray[i].szClassPath);
-            return -1;
-        }
-
-        std::string methodSignature = "()L";
-        methodSignature.append(gJObjectMapArray[i].szClassPath);
-        methodSignature.append(";");
-
-        // Get the object form "getInstance"
-        jmethodID methodid = env->GetStaticMethodID(classRef, "getInstance",
-                methodSignature.c_str());
-        if (NULL == methodid) {
-            LOGE("InitializeJObjectMapArray: GetStaticMethodID failed for [%s]",
-                    gJObjectMapArray[i].szClassPath);
-            return -1;
-        }
-
-        // Get the singleton object
-        jobject objectRef = (jobject) env->CallStaticObjectMethod(classRef,
-                methodid);
-        if (NULL == objectRef) {
-            LOGE(
-                    "InitializeJObjectMapArray: CallStaticObjectMethod failed for [%s]",
-                    gJObjectMapArray[i].szClassPath);
-            return -1;
-        }
-
-        gJObjectMapArray[i].object = (jobject) env->NewGlobalRef(objectRef);
-        env->DeleteLocalRef(classRef);
-    }
-
-    LOGI("InitializeJObjectMapArray: Exit");
-    return 0;
-}
-
-jobject GetJObjectInstance(const char *szClassPath) {
-    unsigned int nLen = sizeof(gJObjectMapArray) / sizeof(JObjectMap);
-
-    jobject object = NULL;
-
-    for (unsigned int i = 0; i < nLen; i++) {
-        if (0 == strcmp(gJObjectMapArray[i].szClassPath, szClassPath)) {
-            object = gJObjectMapArray[i].object;
-            break;
-        }
-    }
-
-    return object;
-}
-
-void DeleteObjectMapArray(JNIEnv *env) {
-    LOGI("DeleteObjectMapArray: Enter");
-
-    unsigned int nLen = sizeof(gJObjectMapArray) / sizeof(JObjectMap);
-    for (unsigned int i = 0; i < nLen; i++) {
-        if (NULL != gJObjectMapArray[i].object) {
-            env->DeleteGlobalRef(gJObjectMapArray[i].object);
-            gJObjectMapArray[i].object = NULL;
-        }
-    }
-
-    LOGI("DeleteObjectMapArray: Exit");
-}
-
-JavaVM *EasySetupJVM::m_jvm = NULL;
-std::mutex EasySetupJVM::m_currentThreadMutex;
-JNIEnv *EasySetupJVM::getEnv() {
-    std::unique_lock < std::mutex > scoped_lock(m_currentThreadMutex);
-
-    if (NULL == m_jvm) {
-        LOGE("Failed to get JVM");
-        return NULL;
-    }
-
-    JNIEnv *env = NULL;
-    jint ret = m_jvm->GetEnv((void **) &env, JNI_CURRENT_VERSION);
-    switch (ret) {
-    case JNI_OK:
-        return env;
-    case JNI_EDETACHED:
-        if (0 > m_jvm->AttachCurrentThread(&env, NULL)) {
-            LOGE("Failed to attach current thread to env");
-            return NULL;
-        }
-        return env;
-    case JNI_EVERSION:
-        LOGE("JNI version not supported");
-        return NULL;
-    default:
-        LOGE("Failed to get the environment");
-        return NULL;
-    }
-}
-
-void EasySetupJVM::releaseEnv() {
-    std::unique_lock < std::mutex > scoped_lock(m_currentThreadMutex);
-
-    if (0 == m_jvm) {
-        LOGE("Failed to release JVM");
-        return;
-    }
-
-    m_jvm->DetachCurrentThread();
-}
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
-    LOGD("JNI_OnLoad: Enter");
-
-    if (!vm) {
-        LOGE("JNI_OnLoad: vm is invalid");
-        return JNI_ERR;
-    }
-
-    JNIEnv *env = NULL;
-    if (JNI_OK != vm->GetEnv((void **) &env, JNI_CURRENT_VERSION)) {
-        LOGE("JNI_OnLoad: Version check is failed!");
-        return JNI_ERR;
-    }
-
-    if (0 != InitializeJClassMapArray(env)) {
-        LOGE("JNI_OnLoad: Initialize JClass Array failed!");
-        return JNI_ERR;
-    }
-
-    if (0 != InitializeJObjectMapArray(env)) {
-        LOGE("JNI_OnLoad: Initialize JObject Array failed!");
-        return JNI_ERR;
-    }
-
-    jclass easySetupClassRef = GetJClass(
-            EASY_SETUP_SERVICE_NATIVE_API_CLASS_PATH);
-    if (NULL == easySetupClassRef) {
-        LOGE("JNI_OnLoad: GetJClass gEasySetupClass failed !");
-        return JNI_ERR;
-    }
-    env->RegisterNatives(easySetupClassRef, gEasySetupMethodTable,
-            gEasySetupMethodTableSize);
-
-    EasySetupJVM::m_jvm = vm;
-
-    LOGI("JNI_OnLoad: Exit");
-    return JNI_CURRENT_VERSION;
-}
-
-JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved)
-{
-    LOGD("JNI_OnUnload: Enter");
-
-    JNIEnv *env = NULL;
-    if (JNI_OK != vm->GetEnv((void **)&env, JNI_CURRENT_VERSION))
-    {
-        LOGE("JNI_OnLoad: Version check is failed!");
-        return;
-    }
-
-    // delete all class references
-    DeleteClassMapArray(env);
-
-    // delete all jobject
-    DeleteObjectMapArray(env);
-
-    LOGD("JNI_OnUnload: Exit");
-}
-
-#ifdef __cplusplus
-}
-#endif
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp
deleted file mode 100644 (file)
index 135f6a2..0000000
+++ /dev/null
@@ -1,148 +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 "jni_getter.h"
-
-#include <string>
-
-#include "JniOcResource.h"
-
-#define LOG_TAG "TM_JGetter"
-
-bool JGetter::getJStringField(JNIEnv *env, jobject &object,
-        const char *fieldName, std::string &value) {
-    if (NULL == env || NULL == object || NULL == fieldName) {
-        LOGE("getJStringField invalid parameters");
-        return false;
-    }
-
-    jclass clazz = env->GetObjectClass(object);
-    if (NULL == clazz) {
-        LOGE("GetObjectClass failed [%s]", fieldName);
-        return false;
-    }
-
-    jfieldID fieldID = env->GetFieldID(clazz, fieldName, "Ljava/lang/String;");
-    if (0 == fieldID) {
-        LOGE("GetFieldID failed [%s]", fieldName);
-        env->DeleteLocalRef(clazz);
-        return false;
-    }
-
-    jstring jValue = (jstring) env->GetObjectField(object, fieldID);
-    if (NULL == jValue) {
-        LOGE("GetObjectField failed [%s]", fieldName);
-        env->DeleteLocalRef(clazz);
-        return false;
-    }
-
-    const char *cstr = env->GetStringUTFChars(jValue, 0);
-    if (cstr == NULL) {
-        LOGE("GetStringUTFChars failed");
-    } else {
-        value = cstr;
-        env->ReleaseStringUTFChars(jValue, cstr);
-    }
-
-    env->DeleteLocalRef(clazz);
-    env->DeleteLocalRef(jValue);
-
-    return true;
-}
-
-bool JGetter::getJBoolField(JNIEnv *env, jobject &object, const char *fieldName,
-        bool &value) {
-    if (NULL == env || NULL == object || NULL == fieldName) {
-        LOGE("getJBoolField invalid parameters");
-        return false;
-    }
-
-    jclass clazz = env->GetObjectClass(object);
-    if (NULL == clazz) {
-        LOGE("GetObjectClass failed");
-        return false;
-    }
-
-    jfieldID fieldID = env->GetFieldID(clazz, fieldName, "Z");
-    if (0 == fieldID) {
-        LOGE("GetFieldID failed [%s]", fieldName);
-        env->DeleteLocalRef(clazz);
-        return false;
-    }
-
-    value = env->GetBooleanField(object, fieldID);
-
-    env->DeleteLocalRef(clazz);
-
-    return true;
-}
-
-bool JGetter::getJIntField(JNIEnv *env, jobject &object, const char *fieldName,
-        int &value) {
-    if (NULL == env || NULL == object || NULL == fieldName) {
-        LOGE("getJIntField invalid parameters");
-        return false;
-    }
-
-    jclass clazz = env->GetObjectClass(object);
-    if (NULL == clazz) {
-        LOGE("GetObjectClass failed");
-        return false;
-    }
-
-    jfieldID fieldID = env->GetFieldID(clazz, fieldName, "I");
-    if (0 == fieldID) {
-        LOGE("GetFieldID failed [%s]", fieldName);
-        env->DeleteLocalRef(clazz);
-        return false;
-    }
-
-    value = env->GetIntField(object, fieldID);
-
-    env->DeleteLocalRef(clazz);
-
-    return true;
-}
-
-bool JGetter::getJObjectField(JNIEnv *env, jobject &object,
-        const char *fieldName, const char *fieldType, jobject &value) {
-    if (NULL == env || NULL == object || NULL == fieldName) {
-        return false;
-    }
-
-    jclass clazz = env->GetObjectClass(object);
-    if (NULL == clazz) {
-        return false;
-    }
-
-    jfieldID fieldID = env->GetFieldID(clazz, fieldName, fieldType);
-    if (0 == fieldID) {
-        LOGE("GetFieldID failed [%s][%s]", fieldName, fieldType);
-        return false;
-    }
-
-    value = env->GetObjectField(object, fieldID);
-    if (NULL == value) {
-        return false;
-    }
-
-    env->DeleteLocalRef(clazz);
-
-    return true;
-}
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp
deleted file mode 100644 (file)
index 51c6bf6..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "jni_object.h"
-
-//#define NULL 0
-#define LOG_TAG "TM_JObject"
-
-JObject::JObject(JNIEnv *env) :
-               m_pEnv(env), m_pObject(NULL), m_pClazz(NULL), m_fIsNewObject(true) {
-}
-
-JObject::JObject(JNIEnv *env, jobject obj) :
-               m_pEnv(NULL), m_pObject(NULL), m_pClazz(NULL), m_fIsNewObject(false) {
-       if (NULL == env || NULL == obj) {
-               return;
-       }
-
-       m_pEnv = env;
-       m_pObject = obj;
-       m_pClazz = m_pEnv->GetObjectClass(obj);
-}
-
-JObject::JObject(JNIEnv *env, const char *classPath) :
-               m_pEnv(NULL), m_pObject(NULL), m_pClazz(NULL), m_fIsNewObject(true) {
-       if (NULL == env || NULL == classPath) {
-               LOGI("JObject Invalid parameters");
-               return;
-       }
-
-       m_pEnv = env;
-       //m_pClazz = GetJClass( classPath );
-
-       if (NULL == m_pClazz) {
-               LOGE("GetJClass failed [%s]", classPath);
-               return;
-       }
-
-       jmethodID mid = env->GetMethodID(m_pClazz, "<init>", "()V");
-       if (NULL == mid) {
-               LOGE("GetMethodID failed [%s]", classPath);
-               return;
-       }
-
-       m_pObject = env->NewObject(m_pClazz, mid);
-}
-
-JObject::~JObject() {
-       if (m_pEnv) {
-               if (m_pObject && m_fIsNewObject) {
-                       m_pEnv->DeleteLocalRef(m_pObject);
-               }
-
-               if (m_pClazz && !m_fIsNewObject) {
-                       m_pEnv->DeleteLocalRef(m_pClazz);
-               }
-       }
-}
-
-jobject JObject::getObject() const {
-       return m_pObject;
-}
-
-void JObject::detachObject() {
-       if (m_fIsNewObject) {
-               m_fIsNewObject = false;
-               m_pClazz = NULL;
-       }
-}
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp
deleted file mode 100644 (file)
index 6c38004..0000000
+++ /dev/null
@@ -1,175 +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 "jni_setter.h"
-
-#include <string>
-
-#include "JniOcResource.h"
-
-#define LOG_TAG "TM_JSetter"
-
-bool JSetter::setJStringField(JNIEnv *env, jobject &object,
-               const char *fieldName, const char *value) {
-       if (NULL == env || NULL == fieldName) {
-               LOGE("setJStringField invalid parameters");
-               return false;
-       }
-
-       jclass clazz = env->GetObjectClass(object);
-       if (NULL == clazz) {
-               LOGE("GetObjectClass failed");
-               return false;
-       }
-
-       jfieldID fieldID = env->GetFieldID(clazz, fieldName, "Ljava/lang/String;");
-       if (0 == fieldID) {
-               LOGE("GetFieldID failed [%s]", fieldName);
-               env->DeleteLocalRef(clazz);
-               return false;
-       }
-
-       jstring jvalue;
-       if (value != NULL && strlen(value) > 0) {
-               jclass strClass = env->FindClass("java/lang/String");
-               jmethodID ctorID = env->GetMethodID(strClass, "<init>",
-                               "([BLjava/lang/String;)V");
-               jbyteArray bytes = env->NewByteArray(strlen(value));
-               env->SetByteArrayRegion(bytes, 0, strlen(value), (jbyte *) value);
-               jstring encoding = env->NewStringUTF("utf-8");
-               jvalue = (jstring) env->NewObject(strClass, ctorID, bytes, encoding);
-               env->DeleteLocalRef(strClass);
-               env->DeleteLocalRef(bytes);
-               env->DeleteLocalRef(encoding);
-       } else {
-               jvalue = env->NewStringUTF("");
-       }
-
-       env->SetObjectField(object, fieldID, jvalue);
-
-       env->DeleteLocalRef(jvalue);
-       env->DeleteLocalRef(clazz);
-
-       return true;
-}
-
-bool JSetter::setJIntField(JNIEnv *env, jobject &object, const char *fieldName,
-               int value) {
-       if (NULL == env || NULL == fieldName) {
-               LOGE("setJIntField invalid paramter");
-               return false;
-       }
-
-       jclass clazz = env->GetObjectClass(object);
-       if (NULL == clazz) {
-               LOGE("GetObjectClass failed");
-               return false;
-       }
-
-       jfieldID fieldID = env->GetFieldID(clazz, fieldName, "I");
-       if (0 == fieldID) {
-               LOGE("GetFieldID failed [%s]", fieldName);
-               env->DeleteLocalRef(clazz);
-               return false;
-       }
-       env->SetIntField(object, fieldID, value);
-
-       env->DeleteLocalRef(clazz);
-
-       return true;
-}
-
-bool JSetter::setJLongField(JNIEnv *env, jobject &object, const char *fieldName,
-               jlong value) {
-       if (NULL == env || NULL == fieldName) {
-               LOGE("setJLongField invalid parameters");
-               return false;
-       }
-
-       jclass clazz = env->GetObjectClass(object);
-       if (NULL == clazz) {
-               LOGE("GetObjectClass failed");
-               return false;
-       }
-
-       jfieldID fieldID = env->GetFieldID(clazz, fieldName, "J");
-       if (0 == fieldID) {
-               LOGE("GetFieldID failed [%s]", fieldName);
-               env->DeleteLocalRef(clazz);
-               return false;
-       }
-       env->SetLongField(object, fieldID, value);
-
-       env->DeleteLocalRef(clazz);
-
-       return true;
-}
-
-bool JSetter::setJBoolField(JNIEnv *env, jobject &object, const char *fieldName,
-               bool value) {
-       if (NULL == env || NULL == fieldName) {
-               LOGE("setJBoolField invalid parameters");
-               return false;
-       }
-
-       jclass clazz = env->GetObjectClass(object);
-       if (NULL == clazz) {
-               LOGE("GetObjectClass failed");
-               return false;
-       }
-
-       jfieldID fieldID = env->GetFieldID(clazz, fieldName, "Z");
-       if (0 == fieldID) {
-               LOGE("GetFieldID failed [%s]", fieldName);
-               env->DeleteLocalRef(clazz);
-               return false;
-       }
-       env->SetBooleanField(object, fieldID, value);
-
-       env->DeleteLocalRef(clazz);
-
-       return true;
-}
-
-bool JSetter::setJObjectField(JNIEnv *env, jobject &object,
-               const char *fieldName, const char *fieldType, const jobject value) {
-       if (NULL == env || NULL == fieldName) {
-               LOGE("setJBoolField invalid parameters");
-               return false;
-       }
-
-       jclass clazz = env->GetObjectClass(object);
-       if (NULL == clazz) {
-               LOGE("GetObjectClass failed");
-               return false;
-       }
-
-       jfieldID fieldID = env->GetFieldID(clazz, fieldName, fieldType);
-       if (0 == fieldID) {
-               LOGE("GetFieldID failed [%s] [%s]", fieldName, fieldType);
-               env->DeleteLocalRef(clazz);
-               return false;
-       }
-       env->SetObjectField(object, fieldID, value);
-
-       env->DeleteLocalRef(clazz);
-
-       return true;
-}
-
diff --git a/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp
deleted file mode 100644 (file)
index 93bcdf4..0000000
+++ /dev/null
@@ -1,62 +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 "jni_string.h"
-
-#define LOG_TAG "TM_JString"
-
-JString::JString(JNIEnv *env, jstring value) :
-               JObject(env, value) {
-       const char *buff = env->GetStringUTFChars(value, 0);
-
-       m_cstr = buff;
-
-       env->ReleaseStringUTFChars(value, buff);
-}
-
-JString::JString(JNIEnv *env, const char *value) :
-               JObject(env) {
-       m_cstr = value;
-
-       if (env) {
-               m_pObject = env->NewStringUTF(value);
-       }
-}
-
-JString::JString(JNIEnv *env, const std::string &value) :
-               JObject(env) {
-       m_cstr = value;
-
-       if (env) {
-               m_pObject = env->NewStringUTF(value.c_str());
-       }
-}
-
-JString::~JString() {
-}
-
-bool JString::getValue(std::string &value) {
-       value = m_cstr;
-       return true;
-}
-
-const char *JString::c_str() {
-       return m_cstr.c_str();
-}
-
diff --git a/service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IProvisionStatusNativeHandler.java b/service/easy-setup/sdk/mediator/android/richsdk/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/IProvisionStatusNativeHandler.java
deleted file mode 100644 (file)
index c66288f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.iotivity.service.easysetup.mediator;
-
-
-public interface IProvisionStatusNativeHandler {
-
-    public void onStatusRecieved(int state);
-
-}
diff --git a/service/easy-setup/sdk/mediator/android/richsdk/jni/Android.mk b/service/easy-setup/sdk/mediator/android/richsdk/jni/Android.mk
deleted file mode 100644 (file)
index 3e6dae4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../../../out/android/$(TARGET_ARCH_ABI)/debug
-LOCAL_MODULE := android-octbstack
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboctbstack.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../../../out/android/$(TARGET_ARCH_ABI)/debug
-LOCAL_MODULE := android-connectivity_abstraction
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libconnectivity_abstraction.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../../../out/android/$(TARGET_ARCH_ABI)/debug
-LOCAL_MODULE := android-easysetup
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libESSDKLibrary.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE    := easysetup-jni
-
-#Add Pre processor definitions
-DEFINE_FLAG =  -DWITH_POSIX -D__ANDROID__
-
-#Add Debug flags here
-DEBUG_FLAG      = -DTB_LOG
-
-BUILD_FLAG = $(DEFINE_FLAG) $(DEBUG_FLAG)
-
-LOCAL_CPPFLAGS = $(BUILD_FLAG)
-LOCAL_CPPFLAGS += -std=c++0x -frtti -fexceptions
-
-$(info CPPFLAGSUPDATED=$(LOCAL_CPPFLAGS))
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH) \
-                                       $(LOCAL_PATH)/../../../../../../../service/easy-setup/sdk/mediator/include \
-                                       $(LOCAL_PATH)/../../../../../../../service/easy-setup/sdk/mediator/src \
-                                       $(LOCAL_PATH)/../../../../../../../service/easy-setup/sdk/common \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/logger/include \
-                                   $(LOCAL_PATH)/../../../../../../../resource/csdk/connectivity/common/inc \
-                                       $(LOCAL_PATH)/../../../../../../../resource/c_common/oic_string/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/c_common \
-                                       $(LOCAL_PATH)/../../../../../../../resource/oc_logger/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/ocmalloc/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/connectivity/api \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/stack/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/logger/include \
-                                       $(LOCAL_PATH)/../../../../../../../resource/csdk/security/include \
-                                       $(LOCAL_PATH)/../../../../../../../extlibs/cjson \
-                                       $(LOCAL_PATH)/../../../../../../../extlibs/boost/boost_1_58_0 \
-                    $(LOCAL_PATH)/../../../../../../../extlibs/timer \
-                                       $(LOCAL_PATH)/../../../../../../../android/android_api/base/jni \
-
-LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.cpp))
-LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.h))
-
-LOCAL_LDLIBS := -llog
-LOCAL_SHARED_LIBRARIES += android-connectivity_abstraction
-LOCAL_SHARED_LIBRARIES += android-octbstack
-LOCAL_SHARED_LIBRARIES += android-easysetup
-
-include $(BUILD_SHARED_LIBRARY)
index 7584cb2..09ba5c4 100755 (executable)
@@ -137,8 +137,8 @@ cp resource/include/*.h %{buildroot}%{_includedir}
 cp resource/c_common/*.h %{buildroot}%{_includedir}
 
 cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
-cp service/easy-setup/sdk/common/*.h %{buildroot}%{_includedir}
-cp service/easy-setup/sdk/enrollee/api/*.h %{buildroot}%{_includedir}
+cp service/easy-setup/inc/*.h %{buildroot}%{_includedir}
+cp service/easy-setup/enrollee/inc/*.h %{buildroot}%{_includedir}
 
 cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
 
@@ -168,7 +168,6 @@ cp service/things-manager/sdk/inc/*.h %{buildroot}%{_includedir}
 %{_libdir}/librcs_common.so
 %{_libdir}/librcs_container.so
 %{_libdir}/librcs_server.so
-%{_libdir}/libESSDKLibrary.so
 
 %files test
 %manifest %{name}-test.manifest