From 760d0f015661f27042768f8a6e979cf38b91e348 Mon Sep 17 00:00:00 2001 From: Madan Lanka Date: Thu, 18 Jun 2015 05:15:12 -0400 Subject: [PATCH] Changed the folder structure and changed the shared library to static library 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/1340 Reviewed-by: Uze Choi Tested-by: Uze Choi --- service/easy-setup/SConscript | 25 ++- .../sampleapp/linux/richclient/SConscript | 4 +- .../sdk/android/EasySetupCore/.classpath | 9 - .../easy-setup/sdk/android/EasySetupCore/.project | 33 ---- service/easy-setup/sdk/android/jni/Android.mk | 112 ------------- .../sdk/arduino/wifi/inc/networkHandler.h | 76 --------- .../sdk/arduino/wifi/src/networkHandler.cpp | 185 --------------------- service/easy-setup/sdk/common/common.h | 98 +++++++++++ service/easy-setup/sdk/inc/easysetupcommon.h | 122 -------------- .../sdk/{ => mediator}/android/.gitignore | 0 .../android/EasySetupCore/AndroidManifest.xml | 0 .../android/EasySetupCore/project.properties | 0 .../res/drawable-hdpi/ic_launcher.png | Bin .../android/EasySetupCore/res/values/strings.xml | 0 .../android/EasySetupCore/res/values/styles.xml | 0 .../mediator/EasySetupCallbackHandler.java | 0 .../easysetup/mediator/EasySetupManager.java | 3 - .../service/easysetup/mediator/EnrolleeInfo.java | 0 .../easysetup/mediator/EnrolleeOnBoardingInfo.java | 0 .../easysetup/mediator/IOnBoardingStatus.java | 0 .../easysetup/mediator/IProvisioningListener.java | 0 .../easysetup/mediator/OnBoardEnrollee.java | 0 .../easysetup/mediator/ProvisionEnrollee.java | 0 .../easysetup/mediator/WiFiSoftAPManager.java | 0 .../easy-setup/sdk/mediator/android/jni/Android.mk | 84 ++++++++++ .../sdk/{ => mediator}/android/jni/Application.mk | 1 + .../{ => mediator}/android/jni/jni_easy_setup.cpp | 0 .../{ => mediator}/android/jni/jni_easy_setup.h | 0 .../android/jni/jniutil/inc/jni_easy_setup_jvm.h | 0 .../android/jni/jniutil/inc/jni_getter.h | 0 .../android/jni/jniutil/inc/jni_object.h | 0 .../android/jni/jniutil/inc/jni_setter.h | 0 .../android/jni/jniutil/inc/jni_string.h | 0 .../android/jni/jniutil/src/jni_easy_setup_jvm.cpp | 0 .../android/jni/jniutil/src/jni_getter.cpp | 0 .../android/jni/jniutil/src/jni_object.cpp | 0 .../android/jni/jniutil/src/jni_setter.cpp | 0 .../android/jni/jniutil/src/jni_string.cpp | 0 .../sdk/{ => mediator}/inc/easysetupmgr.h | 5 +- .../sdk/mediator/inc/provisioninghandler.h | 86 ++++++++++ .../sdk/{ => mediator}/src/camutex_pthreads.c | 0 .../sdk/{ => mediator}/src/easysetupmgr.cpp | 1 - .../sdk/{ => mediator}/src/provisioninghandler.cpp | 0 43 files changed, 287 insertions(+), 557 deletions(-) delete mode 100644 service/easy-setup/sdk/android/EasySetupCore/.classpath delete mode 100644 service/easy-setup/sdk/android/EasySetupCore/.project delete mode 100644 service/easy-setup/sdk/android/jni/Android.mk delete mode 100755 service/easy-setup/sdk/arduino/wifi/inc/networkHandler.h delete mode 100755 service/easy-setup/sdk/arduino/wifi/src/networkHandler.cpp delete mode 100644 service/easy-setup/sdk/inc/easysetupcommon.h rename service/easy-setup/sdk/{ => mediator}/android/.gitignore (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/AndroidManifest.xml (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/project.properties (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/res/values/strings.xml (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/res/values/styles.xml (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java (93%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java (100%) rename service/easy-setup/sdk/{ => mediator}/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java (100%) create mode 100644 service/easy-setup/sdk/mediator/android/jni/Android.mk rename service/easy-setup/sdk/{ => mediator}/android/jni/Application.mk (72%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jni_easy_setup.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jni_easy_setup.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/inc/jni_easy_setup_jvm.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/inc/jni_getter.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/inc/jni_object.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/inc/jni_setter.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/inc/jni_string.h (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/src/jni_easy_setup_jvm.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/src/jni_getter.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/src/jni_object.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/src/jni_setter.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/android/jni/jniutil/src/jni_string.cpp (100%) rename service/easy-setup/sdk/{ => mediator}/inc/easysetupmgr.h (96%) create mode 100644 service/easy-setup/sdk/mediator/inc/provisioninghandler.h rename service/easy-setup/sdk/{ => mediator}/src/camutex_pthreads.c (100%) rename service/easy-setup/sdk/{ => mediator}/src/easysetupmgr.cpp (98%) rename service/easy-setup/sdk/{ => mediator}/src/provisioninghandler.cpp (100%) diff --git a/service/easy-setup/SConscript b/service/easy-setup/SConscript index 0cf8408..ef4285c 100755 --- a/service/easy-setup/SConscript +++ b/service/easy-setup/SConscript @@ -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 diff --git a/service/easy-setup/sampleapp/linux/richclient/SConscript b/service/easy-setup/sampleapp/linux/richclient/SConscript index f0f606a..09bddda 100644 --- a/service/easy-setup/sampleapp/linux/richclient/SConscript +++ b/service/easy-setup/sampleapp/linux/richclient/SConscript @@ -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 index b76ec6c..0000000 --- a/service/easy-setup/sdk/android/EasySetupCore/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/service/easy-setup/sdk/android/EasySetupCore/.project b/service/easy-setup/sdk/android/EasySetupCore/.project deleted file mode 100644 index ad4699b..0000000 --- a/service/easy-setup/sdk/android/EasySetupCore/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - EasySetupCore - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/service/easy-setup/sdk/android/jni/Android.mk b/service/easy-setup/sdk/android/jni/Android.mk deleted file mode 100644 index 8a0df30..0000000 --- a/service/easy-setup/sdk/android/jni/Android.mk +++ /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 index 89ee67c..0000000 --- a/service/easy-setup/sdk/arduino/wifi/inc/networkHandler.h +++ /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 - -#ifdef ARDUINOWIFI -// Arduino WiFi Shield -#include -#include -#include -#else -// Arduino Ethernet Shield -#include -#include -#include -#include -#include -#include -#include -#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 index 9fef111..0000000 --- a/service/easy-setup/sdk/arduino/wifi/src/networkHandler.cpp +++ /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; - } -} diff --git a/service/easy-setup/sdk/common/common.h b/service/easy-setup/sdk/common/common.h index 3a6fd16..453499c 100755 --- a/service/easy-setup/sdk/common/common.h +++ b/service/easy-setup/sdk/common/common.h @@ -21,6 +21,28 @@ #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 index 8650dd5..0000000 --- a/service/easy-setup/sdk/inc/easysetupcommon.h +++ /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 - diff --git a/service/easy-setup/sdk/android/.gitignore b/service/easy-setup/sdk/mediator/android/.gitignore similarity index 100% rename from service/easy-setup/sdk/android/.gitignore rename to service/easy-setup/sdk/mediator/android/.gitignore diff --git a/service/easy-setup/sdk/android/EasySetupCore/AndroidManifest.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/AndroidManifest.xml similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/AndroidManifest.xml rename to service/easy-setup/sdk/mediator/android/EasySetupCore/AndroidManifest.xml diff --git a/service/easy-setup/sdk/android/EasySetupCore/project.properties b/service/easy-setup/sdk/mediator/android/EasySetupCore/project.properties similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/project.properties rename to service/easy-setup/sdk/mediator/android/EasySetupCore/project.properties diff --git a/service/easy-setup/sdk/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png b/service/easy-setup/sdk/mediator/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png rename to service/easy-setup/sdk/mediator/android/EasySetupCore/res/drawable-hdpi/ic_launcher.png diff --git a/service/easy-setup/sdk/android/EasySetupCore/res/values/strings.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/strings.xml similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/res/values/strings.xml rename to service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/strings.xml diff --git a/service/easy-setup/sdk/android/EasySetupCore/res/values/styles.xml b/service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/styles.xml similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/res/values/styles.xml rename to service/easy-setup/sdk/mediator/android/EasySetupCore/res/values/styles.xml diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupCallbackHandler.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java similarity index 93% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java index f5cea15..0319f79 100644 --- a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java +++ b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EasySetupManager.java @@ -45,10 +45,7 @@ public class EasySetupManager { // Load Easy Setup JNI interface System.loadLibrary("gnustl_shared"); System.loadLibrary("octbstack"); - System.loadLibrary("oc"); System.loadLibrary("connectivity_abstraction"); - System.loadLibrary("ca-interface"); - System.loadLibrary("ESSDK"); System.loadLibrary("easysetup-jni"); } diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeInfo.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/EnrolleeOnBoardingInfo.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IOnBoardingStatus.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/IProvisioningListener.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/OnBoardEnrollee.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/ProvisionEnrollee.java diff --git a/service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java similarity index 100% rename from service/easy-setup/sdk/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java rename to service/easy-setup/sdk/mediator/android/EasySetupCore/src/org/iotivity/service/easysetup/mediator/WiFiSoftAPManager.java 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 index 0000000..d85ab3f --- /dev/null +++ b/service/easy-setup/sdk/mediator/android/jni/Android.mk @@ -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 diff --git a/service/easy-setup/sdk/android/jni/Application.mk b/service/easy-setup/sdk/mediator/android/jni/Application.mk similarity index 72% rename from service/easy-setup/sdk/android/jni/Application.mk rename to service/easy-setup/sdk/mediator/android/jni/Application.mk index fff0785..d5fc03c 100644 --- a/service/easy-setup/sdk/android/jni/Application.mk +++ b/service/easy-setup/sdk/mediator/android/jni/Application.mk @@ -1,3 +1,4 @@ APP_STL := gnustl_shared +APP_PLATFORM = android-21 NDK_TOOLCHAIN_VERSION := 4.8 diff --git a/service/easy-setup/sdk/android/jni/jni_easy_setup.cpp b/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jni_easy_setup.cpp rename to service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp diff --git a/service/easy-setup/sdk/android/jni/jni_easy_setup.h b/service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jni_easy_setup.h rename to service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/inc/jni_easy_setup_jvm.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/inc/jni_easy_setup_jvm.h rename to service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_easy_setup_jvm.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/inc/jni_getter.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/inc/jni_getter.h rename to service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_getter.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/inc/jni_object.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/inc/jni_object.h rename to service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_object.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/inc/jni_setter.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/inc/jni_setter.h rename to service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_setter.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/inc/jni_string.h b/service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/inc/jni_string.h rename to service/easy-setup/sdk/mediator/android/jni/jniutil/inc/jni_string.h diff --git a/service/easy-setup/sdk/android/jni/jniutil/src/jni_easy_setup_jvm.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/src/jni_easy_setup_jvm.cpp rename to service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_easy_setup_jvm.cpp diff --git a/service/easy-setup/sdk/android/jni/jniutil/src/jni_getter.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/src/jni_getter.cpp rename to service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_getter.cpp diff --git a/service/easy-setup/sdk/android/jni/jniutil/src/jni_object.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/src/jni_object.cpp rename to service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_object.cpp diff --git a/service/easy-setup/sdk/android/jni/jniutil/src/jni_setter.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/src/jni_setter.cpp rename to service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_setter.cpp diff --git a/service/easy-setup/sdk/android/jni/jniutil/src/jni_string.cpp b/service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp similarity index 100% rename from service/easy-setup/sdk/android/jni/jniutil/src/jni_string.cpp rename to service/easy-setup/sdk/mediator/android/jni/jniutil/src/jni_string.cpp diff --git a/service/easy-setup/sdk/inc/easysetupmgr.h b/service/easy-setup/sdk/mediator/inc/easysetupmgr.h similarity index 96% rename from service/easy-setup/sdk/inc/easysetupmgr.h rename to service/easy-setup/sdk/mediator/inc/easysetupmgr.h index 683ef2d..a3e18de 100644 --- a/service/easy-setup/sdk/inc/easysetupmgr.h +++ b/service/easy-setup/sdk/mediator/inc/easysetupmgr.h @@ -25,7 +25,10 @@ #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 index 0000000..8bad6c5 --- /dev/null +++ b/service/easy-setup/sdk/mediator/inc/provisioninghandler.h @@ -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 + diff --git a/service/easy-setup/sdk/src/camutex_pthreads.c b/service/easy-setup/sdk/mediator/src/camutex_pthreads.c similarity index 100% rename from service/easy-setup/sdk/src/camutex_pthreads.c rename to service/easy-setup/sdk/mediator/src/camutex_pthreads.c diff --git a/service/easy-setup/sdk/src/easysetupmgr.cpp b/service/easy-setup/sdk/mediator/src/easysetupmgr.cpp similarity index 98% rename from service/easy-setup/sdk/src/easysetupmgr.cpp rename to service/easy-setup/sdk/mediator/src/easysetupmgr.cpp index 3dda241..98480f4 100644 --- a/service/easy-setup/sdk/src/easysetupmgr.cpp +++ b/service/easy-setup/sdk/mediator/src/easysetupmgr.cpp @@ -26,7 +26,6 @@ #include #include "easysetupmgr.h" -#include "provisioninghandler.h" //Use ipv4addr for both InitDiscovery and InitDeviceDiscovery char ipv4addr[IPV4_ADDR_SIZE] = { 0 }; diff --git a/service/easy-setup/sdk/src/provisioninghandler.cpp b/service/easy-setup/sdk/mediator/src/provisioninghandler.cpp similarity index 100% rename from service/easy-setup/sdk/src/provisioninghandler.cpp rename to service/easy-setup/sdk/mediator/src/provisioninghandler.cpp -- 2.7.4