Changed the folder structure and changed the shared library to static library
authorMadan Lanka <lanka.madan@samsung.com>
Thu, 18 Jun 2015 09:15:12 +0000 (05:15 -0400)
committerUze Choi <uzchoi@samsung.com>
Fri, 19 Jun 2015 01:45:57 +0000 (01:45 +0000)
1. Changed the folder structure to organize enrollee and mediator code
2. Changed the shared library to static library to reduce the number of libraries loaded in Java

Change-Id: I6c099c42f97dce3666115aa2469a7f88db12e04a
Signed-off-by: Madan Lanka <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1340
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
43 files changed:
service/easy-setup/SConscript
service/easy-setup/sampleapp/linux/richclient/SConscript
service/easy-setup/sdk/android/EasySetupCore/.classpath [deleted file]
service/easy-setup/sdk/android/EasySetupCore/.project [deleted file]
service/easy-setup/sdk/android/jni/Android.mk [deleted file]
service/easy-setup/sdk/arduino/wifi/inc/networkHandler.h [deleted file]
service/easy-setup/sdk/arduino/wifi/src/networkHandler.cpp [deleted file]
service/easy-setup/sdk/common/common.h
service/easy-setup/sdk/inc/easysetupcommon.h [deleted file]
service/easy-setup/sdk/mediator/android/.gitignore [moved from service/easy-setup/sdk/android/.gitignore with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/AndroidManifest.xml [moved from service/easy-setup/sdk/android/EasySetupCore/AndroidManifest.xml with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/project.properties [moved from service/easy-setup/sdk/android/EasySetupCore/project.properties with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png [moved from service/easy-setup/sdk/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/strings.xml [moved from service/easy-setup/sdk/android/EasySetupCore/res/values/strings.xml with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/styles.xml [moved from service/easy-setup/sdk/android/EasySetupCore/res/values/styles.xml with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java with 93% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java with 100% similarity]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java [moved from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/Android.mk [new file with mode: 0644]
service/easy-setup/sdk/mediator/android/jni/Application.mk [moved from service/easy-setup/sdk/android/jni/Application.mk with 72% similarity]
service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp [moved from service/easy-setup/sdk/android/jni/jni_easy_setup.cpp with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h [moved from service/easy-setup/sdk/android/jni/jni_easy_setup.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h [moved from service/easy-setup/sdk/android/jni/jniutil/inc/jni_easy_setup_jvm.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h [moved from service/easy-setup/sdk/android/jni/jniutil/inc/jni_getter.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h [moved from service/easy-setup/sdk/android/jni/jniutil/inc/jni_object.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h [moved from service/easy-setup/sdk/android/jni/jniutil/inc/jni_setter.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h [moved from service/easy-setup/sdk/android/jni/jniutil/inc/jni_string.h with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp [moved from service/easy-setup/sdk/android/jni/jniutil/src/jni_easy_setup_jvm.cpp with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp [moved from service/easy-setup/sdk/android/jni/jniutil/src/jni_getter.cpp with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp [moved from service/easy-setup/sdk/android/jni/jniutil/src/jni_object.cpp with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp [moved from service/easy-setup/sdk/android/jni/jniutil/src/jni_setter.cpp with 100% similarity]
service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp [moved from service/easy-setup/sdk/android/jni/jniutil/src/jni_string.cpp with 100% similarity]
service/easy-setup/sdk/mediator/inc/easysetupmgr.h [moved from service/easy-setup/sdk/inc/easysetupmgr.h with 96% similarity]
service/easy-setup/sdk/mediator/inc/provisioninghandler.h [new file with mode: 0644]
service/easy-setup/sdk/mediator/src/camutex_pthreads.c [moved from service/easy-setup/sdk/src/camutex_pthreads.c with 100% similarity]
service/easy-setup/sdk/mediator/src/easysetupmgr.cpp [moved from service/easy-setup/sdk/src/easysetupmgr.cpp with 98% similarity]
service/easy-setup/sdk/mediator/src/provisioninghandler.cpp [moved from service/easy-setup/sdk/src/provisioninghandler.cpp with 100% similarity]

index 0cf8408..ef4285c 100755 (executable)
@@ -51,12 +51,10 @@ if target_os in ['android', 'linux']:
        easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
        if target_os not in ['linux', 'arduino']:
                easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])      
+               if not env.get('RELEASE'):
+                       easy_setup_env.AppendUnique(LIBS = ['log'])
        else:
                easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
-       
-       if not env.get('RELEASE'):
-               easy_setup_env.AppendUnique(LIBS = ['log'])
-       
 
 if target_os == 'arduino':
        easy_setup_env.AppendUnique(CPPPATH = [
@@ -76,8 +74,9 @@ if target_os in ['android','linux']:
         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/cjson',
+               'sdk/common',
+               'sdk/mediator/inc'])
 
 ######################################################################
 # Source files and Targets
@@ -92,17 +91,17 @@ if target_os == 'arduino':
 
 
 if target_os == 'android':
-       es_sdk_shared = easy_setup_env.SharedLibrary('libESSDK',
-                                       ['sdk/src/easysetupmgr.cpp',
-                                       'sdk/src/camutex_pthreads.c',
-                                       'sdk/src/provisioninghandler.cpp'])
+       es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
+                                       ['sdk/mediator/src/easysetupmgr.cpp',
+                                       'sdk/mediator/src/camutex_pthreads.c',
+                                       'sdk/mediator/src/provisioninghandler.cpp'])
        easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
 
 if target_os == 'linux':
        es_sdk_shared = easy_setup_env.SharedLibrary('ESSDKLibrary',
-                                       ['sdk/src/easysetupmgr.cpp',
-                                       'sdk/src/camutex_pthreads.c',
-                                       'sdk/src/provisioninghandler.cpp'])
+                                       ['sdk/mediator/src/easysetupmgr.cpp',
+                                       'sdk/mediator/src/camutex_pthreads.c',
+                                       'sdk/mediator/src/provisioninghandler.cpp'])
        easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK')
 
 #Go to build sample apps
index f0f606a..09bddda 100644 (file)
@@ -38,8 +38,8 @@ richclient_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/inc'
-                       ])
+                       env.get('SRC_DIR') + '/service/easy-setup/sdk/mediator/inc',
+                       env.get('SRC_DIR') + '/service/easy-setup/sdk/common'])
 
 richclient_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction', 'coap', 'ESSDKLibrary'])
 
diff --git a/service/easy-setup/sdk/android/EasySetupCore/.classpath b/service/easy-setup/sdk/android/EasySetupCore/.classpath
deleted file mode 100644 (file)
index b76ec6c..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
-       <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>\r
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>\r
-       <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>\r
-       <classpathentry kind="src" path="src"/>\r
-       <classpathentry kind="src" path="gen"/>\r
-       <classpathentry kind="output" path="bin/classes"/>\r
-</classpath>\r
diff --git a/service/easy-setup/sdk/android/EasySetupCore/.project b/service/easy-setup/sdk/android/EasySetupCore/.project
deleted file mode 100644 (file)
index ad4699b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<projectDescription>\r
-       <name>EasySetupCore</name>\r
-       <comment></comment>\r
-       <projects>\r
-       </projects>\r
-       <buildSpec>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>org.eclipse.jdt.core.javabuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-               <buildCommand>\r
-                       <name>com.android.ide.eclipse.adt.ApkBuilder</name>\r
-                       <arguments>\r
-                       </arguments>\r
-               </buildCommand>\r
-       </buildSpec>\r
-       <natures>\r
-               <nature>com.android.ide.eclipse.adt.AndroidNature</nature>\r
-               <nature>org.eclipse.jdt.core.javanature</nature>\r
-       </natures>\r
-</projectDescription>\r
diff --git a/service/easy-setup/sdk/android/jni/Android.mk b/service/easy-setup/sdk/android/jni/Android.mk
deleted file mode 100644 (file)
index 8a0df30..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-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 := ../../../../../dep/android/$(TARGET_ARCH_ABI)/usr/lib
-LOCAL_MODULE := libandroid-boost_system
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libboost_system.a
-include $(PREBUILT_STATIC_LIBRARY)
-
-include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../out/android/$(TARGET_ARCH_ABI)/debug
-LOCAL_MODULE := android-oc_logger
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboc_logger.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-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-oc
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboc.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 := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
-LOCAL_MODULE := android-ocstack-jni
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
-LOCAL_MODULE := android-ca-interface
-LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libca-interface.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)/libESSDK.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))
-
-NDK_ROOT         := /home/madan/android-ndk-r10d
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH) \
-                                       $(LOCAL_PATH)/jniutil/inc \
-                                       $(LOCAL_PATH)/../../../../../service/easy-setup/sdk/inc \
-                                       $(LOCAL_PATH)/../../../../../resource/csdk/logger/include \
-                                       $(LOCAL_PATH)/../../../../../resource/csdk/connectivity/common/inc \
-                                       $(LOCAL_PATH)/../../../../../resource/include \
-                                       $(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 \
-                                       $(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_STATIC_LIBRARIES := android-boost_system
-
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
diff --git a/service/easy-setup/sdk/arduino/wifi/inc/networkHandler.h b/service/easy-setup/sdk/arduino/wifi/inc/networkHandler.h
deleted file mode 100755 (executable)
index 89ee67c..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// Do not remove the include below
-#include "Arduino.h"
-
-#include "logger.h"
-#include "ocstack.h"
-#include <string.h>
-
-#ifdef ARDUINOWIFI
-// Arduino WiFi Shield
-#include <SPI.h>
-#include <WiFi.h>
-#include <WiFiUdp.h>
-#else
-// Arduino Ethernet Shield
-#include <EthernetServer.h>
-#include <Ethernet.h>
-#include <Dns.h>
-#include <EthernetClient.h>
-#include <util.h>
-#include <EthernetUdp.h>
-#include <Dhcp.h>
-#endif
-
-#include "common.h"
-
-#ifndef ES_NETWORK_HANDLER_H_
-#define ES_NETWORK_HANDLER_H_
-
-#define MAXSSIDLEN 33
-#define MAXNETCREDLEN 20
-#define MAXNUMTYPE 5
-#define MAXADDRLEN 15
-
-typedef void (*NetworkEventCallback)(ES_RESULT);
-
-enum NetworkType
-{
-    ES_WIFI = 1, ES_BT = 2, ES_BLE = 3, ES_ZIGBEE = 4, ES_ETH = 5
-};
-
-typedef struct NETWORKINFO
-{
-    NetworkType type;
-
-    // for WiFI
-    IPAddress ipaddr;
-    char ssid[MAXSSIDLEN];
-
-    // for BT, BLE
-    byte mac[6];
-} NetworkInfo;
-
-ES_RESULT ConnectToWiFiNetworkForOnboarding(char *ssid, char *pass, NetworkEventCallback);
-int getCurrentNetworkInfo(NetworkType targetType, NetworkInfo *info);
-
-#endif
diff --git a/service/easy-setup/sdk/arduino/wifi/src/networkHandler.cpp b/service/easy-setup/sdk/arduino/wifi/src/networkHandler.cpp
deleted file mode 100755 (executable)
index 9fef111..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-//******************************************************************
-//
-// Copyright 2014 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include "networkHandler.h"
-
-PROGMEM const char TAG[] = "ArduinoServer";
-
-int findNetwork(char *ssid);
-int ConnectToNetwork(char *ssid, char *pass);
-void printEncryptionType(int thisType);
-
-// Arduino WiFi Shield
-// Note : Arduino WiFi Shield currently does NOT support multicast and therefore
-// this server will NOT be listening on 224.0.1.187 multicast address.
-
-static const char ARDUINO_WIFI_SHIELD_UDP_FW_VER[] = "1.1.0";
-
-IPAddress myIP;
-
-ES_RESULT ConnectToWiFiNetworkForOnboarding(char *ssid, char *pass, NetworkEventCallback cb)
-{
-    char *fwVersion;
-    int status = WL_IDLE_STATUS;
-    int res;
-
-    // check for the presence of the shield:
-    if (WiFi.status() == WL_NO_SHIELD)
-    {
-        OC_LOG(ERROR, TAG, PCF("WiFi shield not present"));
-        return ES_ERROR;
-    }
-
-    // Verify that WiFi Shield is running the firmware with all UDP fixes
-    fwVersion = WiFi.firmwareVersion();
-    OC_LOG_V(INFO, TAG, "WiFi Shield Firmware version %s", fwVersion);
-    if (strncmp(fwVersion, ARDUINO_WIFI_SHIELD_UDP_FW_VER, sizeof(ARDUINO_WIFI_SHIELD_UDP_FW_VER))
-            != 0)
-    {
-        OC_LOG(DEBUG, TAG, PCF("!!!!! Upgrade WiFi Shield Firmware version !!!!!!"));
-        return ES_ERROR;
-    }
-
-    while (findNetwork(ssid) == 0) // found
-    {
-        delay(2000);
-    }
-
-    if (cb != NULL)
-    {
-        cb(ES_NETWORKFOUND);
-    }
-
-    if (WiFi.status() == WL_CONNECTED)
-        WiFi.disconnect();
-
-    res = ConnectToNetwork(ssid, pass);
-
-    if (res == 0)
-    {
-        return ES_NETWORKCONNECTED;
-    }
-    else
-    {
-        return ES_NETWORKNOTCONNECTED;
-    }
-}
-
-int findNetwork(char *ssid)
-{
-    int res = 0;
-    // scan for nearby networks:
-    Serial.println("** Scan Networks **");
-    int numSsid = WiFi.scanNetworks();
-    if (numSsid == -1)
-    {
-        Serial.println("Couldn't get a wifi connection");
-
-        return res;
-    }
-
-    // print the list of networks seen:
-    Serial.print("number of available networks:");
-    Serial.println(numSsid);
-
-    // print the network number and name for each network found:
-    for (int thisNet = 0; thisNet < numSsid; thisNet++)
-    {
-        Serial.print(thisNet);
-        Serial.print(") ");
-        Serial.print(WiFi.SSID(thisNet));
-        Serial.print("\tEncryption: ");
-        printEncryptionType(WiFi.encryptionType(thisNet));
-
-        if (strcmp(WiFi.SSID(thisNet), ssid) == 0)
-        {
-            res = 1;
-        }
-    }
-
-    return res;
-}
-
-int ConnectToNetwork(char *ssid, char *pass)
-{
-    int status = WL_IDLE_STATUS;
-    //IPAddress desiredIP(192, 168, 43, 2);
-    //IPAddress desiredIP(192, 168, 0, 115);
-
-    //WiFi.config(desiredIP);
-
-    // attempt to connect to Wifi network:
-    while (status != WL_CONNECTED)
-    {
-        OC_LOG_V(INFO, TAG, "Attempting to connect to SSID: %s", ssid);
-
-        status = WiFi.begin(ssid, pass);
-
-        // wait 10 seconds for connection:
-        delay(10000);
-    }
-    OC_LOG(DEBUG, TAG, PCF("Connected to wifi"));
-
-    myIP = WiFi.localIP();
-    OC_LOG_V(INFO, TAG, "IP Address:  %d.%d.%d.%d", myIP[0], myIP[1], myIP[2], myIP[3]);
-
-    char buf[50];
-    sprintf(buf, "IP Address:  %d.%d.%d.%d", myIP[0], myIP[1], myIP[2], myIP[3]);
-    Serial.println(buf);
-
-    return 0;
-}
-
-int getCurrentNetworkInfo(NetworkType targetType, NetworkInfo *info)
-{
-    if (targetType == ES_WIFI && WiFi.status() == WL_CONNECTED)
-    {
-        info->type = ES_WIFI;
-        info->ipaddr = WiFi.localIP();
-        strcpy(info->ssid, WiFi.SSID());
-
-        return 0;
-    }
-
-    return -1;
-}
-
-void printEncryptionType(int thisType)
-{
-    // read the encryption type and print out the name:
-    switch (thisType)
-    {
-        case ENC_TYPE_WEP:
-            Serial.println("WEP");
-            break;
-        case ENC_TYPE_TKIP:
-            Serial.println("WPA");
-            break;
-        case ENC_TYPE_CCMP:
-            Serial.println("WPA2");
-            break;
-        case ENC_TYPE_NONE:
-            Serial.println("None");
-            break;
-        case ENC_TYPE_AUTO:
-            Serial.println("Auto");
-            break;
-    }
-}
index 3a6fd16..453499c 100755 (executable)
 #ifndef ES_COMMON_H_
 #define ES_COMMON_H_
 
+#include "ocstack.h"
+#include "octypes.h"
+
+// Defines
+#define OIC_STRING_MAX_VALUE 100
+#define IPV4_ADDR_SIZE 16
+#define IP_PORT 6298
+#define NET_WIFI_SSID_SIZE 16
+#define NET_WIFI_PWD_SIZE 16
+
+/**
+ * @brief Mac address length for BT port
+ */
+#define NET_MACADDR_SIZE 18
+
+//The following variable determines the interface (wifi, ethernet etc.)
+//to be used for sending unicast messages. Default set to Ethernet.
+static OCConnectivityType OC_CONNTYPE = OC_IPV4;
+
+static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.prov";
+static const char * OIC_PROVISIONING_URI = "/oic/prov";
+
 typedef enum
 {
     ES_ERROR = -1,
@@ -35,4 +57,80 @@ typedef enum
     ES_RECVTRIGGEROFPROVRES,
 } ES_RESULT;
 
+
+/**
+ * Provisioning Device Status
+ */
+typedef struct {
+    /// Address of remote server
+    OCDevAddr * addr;
+    /// Indicates adaptor type on which the response was received
+    OCConnectivityType connType;
+} ProvDeviceInfo;
+
+/**
+ * Provosioning Status
+ */
+typedef enum {
+    DEVICE_PROVISIONED = 0, DEVICE_NOT_PROVISIONED
+} ProvStatus;
+
+/**
+ * Response from queries to remote servers. Queries are made by calling the @ref OCDoResource API.
+ */
+typedef struct {
+    // Provisioning Status
+    ProvStatus provStatus;
+    // Provisioning Device Info
+    ProvDeviceInfo provDeviceInfo;
+} ProvisioningInfo;
+
+/**
+ * @brief  Network information of the Enroller
+ */
+typedef union
+{
+    /**
+     * @brief BT Mac Information
+     */
+    struct
+    {
+        char btMacAddress[NET_MACADDR_SIZE];   /**< BT mac address **/
+    } BT;
+
+    /**
+     * @brief LE MAC Information
+     */
+    struct
+    {
+        char leMacAddress[NET_MACADDR_SIZE];   /**< BLE mac address **/
+    } LE;
+
+    /**
+     * @brief IP Information
+     */
+    struct
+    {
+        char ipAddress[IPV4_ADDR_SIZE]; /**< IP Address of the Enroller**/
+        char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the Enroller**/
+        char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the Enroller**/
+    } WIFI;
+} EnrolleeInfo_t;
+
+
+/**
+ * @brief Network Information
+ */
+typedef struct
+{
+    EnrolleeInfo_t netAddressInfo;          /**< Enroller Network Info**/
+    OCConnectivityType connType;            /**< Connectivity Type**/
+    bool isSecured;                         /**< Secure connection**/
+} EnrolleeNWProvInfo_t;
+
+/**
+ * Client applications implement this callback to consume responses received from Servers.
+ */
+typedef void (*OCProvisioningStatusCB)(ProvisioningInfo provInfo);
+
 #endif
diff --git a/service/easy-setup/sdk/inc/easysetupcommon.h b/service/easy-setup/sdk/inc/easysetupcommon.h
deleted file mode 100644 (file)
index 8650dd5..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#ifndef __EASY_CONNECT_COMMON_H_
-#define __EASY_CONNECT_COMMON_H_
-
-#include "ocstack.h"
-#include "octypes.h"
-
-// Defines
-#define OIC_STRING_MAX_VALUE 100
-#define IPV4_ADDR_SIZE 16
-#define IP_PORT 6298
-#define NET_WIFI_SSID_SIZE 16
-#define NET_WIFI_PWD_SIZE 16
-
-/**
- * @brief Mac address length for BT port
- */
-#define NET_MACADDR_SIZE 18
-
-//The following variable determines the interface (wifi, ethernet etc.)
-//to be used for sending unicast messages. Default set to Ethernet.
-static OCConnectivityType OC_CONNTYPE = OC_IPV4;
-
-static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.prov";
-static const char * OIC_PROVISIONING_URI = "/oic/prov";
-
-/**
- * Provisioning Device Status
- */
-typedef struct {
-    /// Address of remote server
-    OCDevAddr * addr;
-    /// Indicates adaptor type on which the response was received
-    OCConnectivityType connType;
-} ProvDeviceInfo;
-
-/**
- * Provosioning Status
- */
-typedef enum {
-    DEVICE_PROVISIONED = 0, DEVICE_NOT_PROVISIONED
-} ProvStatus;
-
-/**
- * Response from queries to remote servers. Queries are made by calling the @ref OCDoResource API.
- */
-typedef struct {
-    // Provisioning Status
-    ProvStatus provStatus;
-    // Provisioning Device Info
-    ProvDeviceInfo provDeviceInfo;
-} ProvisioningInfo;
-
-/**
- * @brief  Network information of the Enroller
- */
-typedef union
-{
-    /**
-     * @brief BT Mac Information
-     */
-    struct
-    {
-        char btMacAddress[NET_MACADDR_SIZE];   /**< BT mac address **/
-    } BT;
-
-    /**
-     * @brief LE MAC Information
-     */
-    struct
-    {
-        char leMacAddress[NET_MACADDR_SIZE];   /**< BLE mac address **/
-    } LE;
-
-    /**
-     * @brief IP Information
-     */
-    struct
-    {
-        char ipAddress[IPV4_ADDR_SIZE]; /**< IP Address of the Enroller**/
-        char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the Enroller**/
-        char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the Enroller**/
-    } WIFI;
-} EnrolleeInfo_t;
-
-
-/**
- * @brief Network Information
- */
-typedef struct
-{
-    EnrolleeInfo_t netAddressInfo;          /**< Enroller Network Info**/
-    OCConnectivityType connType;            /**< Connectivity Type**/
-    bool isSecured;                         /**< Secure connection**/
-} EnrolleeNWProvInfo_t;
-
-/**
- * Client applications implement this callback to consume responses received from Servers.
- */
-typedef void (*OCProvisioningStatusCB)(ProvisioningInfo provInfo);
-
-#endif
-
@@ -45,10 +45,7 @@ public class EasySetupManager {
         // Load Easy Setup JNI interface\r
         System.loadLibrary("gnustl_shared");\r
         System.loadLibrary("octbstack");\r
-        System.loadLibrary("oc");\r
         System.loadLibrary("connectivity_abstraction");\r
-        System.loadLibrary("ca-interface");\r
-        System.loadLibrary("ESSDK");\r
         System.loadLibrary("easysetup-jni");\r
     }\r
 \r
diff --git a/service/easy-setup/sdk/mediator/android/jni/Android.mk b/service/easy-setup/sdk/mediator/android/jni/Android.mk
new file mode 100644 (file)
index 0000000..d85ab3f
--- /dev/null
@@ -0,0 +1,84 @@
+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
+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)/libESSDK.a
+include $(PREBUILT_STATIC_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))
+
+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/common \
+                                       $(LOCAL_PATH)/../../../../../../resource/csdk/logger/include \
+                                       $(LOCAL_PATH)/../../../../../../resource/csdk/connectivity/common/inc \
+                                       $(LOCAL_PATH)/../../../../../../resource/include \
+                                       $(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 \
+                                       $(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_SHARED_LIBRARIES += android-connectivity_abstraction
+LOCAL_SHARED_LIBRARIES += android-octbstack
+
+include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
 #include "logger.h"
 #include "ocstack.h"
 #include "octypes.h"
-#include "easysetupcommon.h"
+#include "common.h"
+
+#include "provisioninghandler.h"
+
 
 //-----------------------------------------------------------------------------
 // Defines
diff --git a/service/easy-setup/sdk/mediator/inc/provisioninghandler.h b/service/easy-setup/sdk/mediator/inc/provisioninghandler.h
new file mode 100644 (file)
index 0000000..8bad6c5
--- /dev/null
@@ -0,0 +1,86 @@
+//******************************************************************
+//
+// 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 __PROVISIONING_HANDLER_H_
+#define __PROVISIONING_HANDLER_H_
+
+#include "logger.h"
+#include "ocstack.h"
+#include "common.h"
+
+//-----------------------------------------------------------------------------
+// Defines
+//-----------------------------------------------------------------------------
+#define TAG "provisioninghandler"
+#define DEFAULT_CONTEXT_VALUE 0x99
+#ifndef MAX_LENGTH_IPv4_ADDR
+#define MAX_LENGTH_IPv4_ADDR 16
+#endif
+
+//-----------------------------------------------------------------------------
+// Typedefs
+//-----------------------------------------------------------------------------
+
+/**
+ * List of methods that can be inititated from the client
+ */
+OCStackResult InitProvisioningHandler();
+
+OCStackResult TerminateProvisioningHandler();
+
+void listeningFunc(void*);
+
+OCStackApplicationResult ProvisionEnrolleeResponse(void* ctx, OCDoHandle handle,
+        OCClientResponse * clientResponse);
+
+OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char* query);
+
+OCStackApplicationResult GetProvisioningStatusResponse(void* ctx,
+        OCDoHandle handle, OCClientResponse * clientResponse);
+
+OCStackResult InvokeOCDoResource(const char* query, OCMethod method,
+        OCQualityOfService qos, OCClientResponseHandler cb, const char* request,
+        OCHeaderOption * options, uint8_t numOptions);
+
+OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char* query);
+
+OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo,
+        OCProvisioningStatusCB provisioningStatusCallback);
+
+
+void StopProvisioningProcess();
+
+OCStackApplicationResult SubscribeProvPresenceCallback(void* ctx, OCDoHandle handle,
+        OCClientResponse* clientResponse);
+
+OCStackResult SubscribeProvPresence(OCQualityOfService qos, const char* requestURI);
+
+OCStackApplicationResult FindProvisioningResourceResponse(void* ctx,
+        OCDoHandle handle, OCClientResponse * clientResponse);
+
+OCStackResult FindProvisioningResource(OCQualityOfService qos,
+        const char* requestURI);
+
+//Invoke Provisioning Status Callback
+void PrepareProvisioingStatusCB(ProvisioningInfo *provInfo,
+        OCClientResponse * clientResponse, ProvStatus provStatus);
+
+#endif
+
@@ -26,7 +26,6 @@
 #include <sstream>
 
 #include "easysetupmgr.h"
-#include "provisioninghandler.h"
 
 //Use ipv4addr for both InitDiscovery and InitDeviceDiscovery
 char ipv4addr[IPV4_ADDR_SIZE] = { 0 };