Modification for SoftAP Onboarding cleanup
authorHemant Mahsky <h.mahsky@samsung.com>
Mon, 28 Sep 2015 10:01:12 +0000 (15:31 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 28 Sep 2015 13:44:55 +0000 (13:44 +0000)
Change-Id: Icebd6ad18a9582069f256d9c5669091faa6b4687
Signed-off-by: Hemant Mahsky <h.mahsky@samsung.com>
Files are formatted
Change-Id: Icebd6ad18a9582069f256d9c5669091faa6b4687
Signed-off-by: Hemant Mahsky <h.mahsky@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3207
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
Tested-by: Madan Lanka <lanka.madan@samsung.com>
28 files changed:
service/easy-setup/SConscript
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/arduino/enrollee_ble.cpp [deleted file]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/AndroidManifest.xml
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/BLEActivity.java [deleted file]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/MainActivity.java [changed mode: 0755->0644]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/OnBoardingSelect.java [deleted file]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_ble.xml [deleted file]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_main.xml [changed mode: 0755->0644]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_on_boarding_select.xml [deleted file]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/menu/main.xml
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/menu/menu_ble.xml [deleted file]
service/easy-setup/sdk/common/common.h
service/easy-setup/sdk/enrollee/arduino/ble/networkHandler.h [deleted file]
service/easy-setup/sdk/enrollee/common/src/easysetupble.cpp [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/core/EasySetupServiceTest.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/androidTest/java/org/iotivity/service/easysetup/core/EnrolleeDeviceFactoryTest.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/AndroidManifest.xml
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/BleConnection.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/EnrolleeDevice.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/BLEOnBoardingConfig.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceBLEOnBoarding.java [deleted file]
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceFactory.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceWiFiOnboarding.java
service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ip/WiFiSoftAPManager.java [changed mode: 0755->0644]
service/easy-setup/sdk/mediator/android/jni/jni_easy_setup.cpp
service/easy-setup/sdk/mediator/src/ble_provisioning.cpp [deleted file]
service/easy-setup/sdk/mediator/src/prov_adapter.cpp

index c0bcecf..fef6e1d 100644 (file)
@@ -59,26 +59,15 @@ if target_os in ['android', 'linux']:
        else:
                easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
 if target_os == 'arduino':
-       if 'BLE' in transport:
-               easy_setup_env.AppendUnique(CPPPATH = [
-                                      '../../resource/oc_logger/include',
-                                      '../../resource/csdk/logger/include',
-                                      '../../resource/csdk/stack/include',
-                                      '../../extlibs/cjson',
-                                          'sdk/enrollee/arduino/ble',
-                                          'sdk/enrollee/common/src',
-                                      'sdk/enrollee/common/inc'])
-               easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESBLE'])                      
-       else:
-               easy_setup_env.AppendUnique(CPPPATH = [
-                                      '../../resource/oc_logger/include',
-                                      '../../resource/csdk/logger/include',
-                                      '../../resource/csdk/stack/include',
-                                      '../../extlibs/cjson',
-                                          'sdk/enrollee/arduino/wifi',
-                                          'sdk/enrollee/common/src',
-                                      'sdk/enrollee/common/inc'])
-               easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
+       easy_setup_env.AppendUnique(CPPPATH = [
+                              '../../resource/oc_logger/include',
+                              '../../resource/csdk/logger/include',
+                              '../../resource/csdk/stack/include',
+                              '../../extlibs/cjson',
+                                  'sdk/enrollee/arduino/wifi',
+                                  'sdk/enrollee/common/src',
+                              'sdk/enrollee/common/inc'])
+       easy_setup_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
 if target_os in ['android','linux']:                                      
        easy_setup_env.PrependUnique(CPPPATH = [
                env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',           
@@ -96,28 +85,17 @@ if target_os in ['android','linux']:
 ######################################################################
 
 if target_os == 'arduino':
-       if 'BLE' in transport:
-               es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
-                                               ['sdk/enrollee/common/src/easysetupble.cpp',
-                                               'sdk/enrollee/common/src/resourceHandler.cpp'])
-       else:
-               es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
-                                               ['sdk/enrollee/common/src/easysetup.cpp',
-                                               'sdk/enrollee/common/src/resourceHandler.cpp',
-                                               'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
+       es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary',
+                                       ['sdk/enrollee/common/src/easysetup.cpp',
+                                       'sdk/enrollee/common/src/resourceHandler.cpp',
+                                       'sdk/enrollee/arduino/wifi/networkHandler.cpp'])
        easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK')
 
 if target_os == 'android':
-       if 'BLE' in transport:
-               es_sdk_shared = easy_setup_env.StaticLibrary('libESSDK',
-                                               ['sdk/mediator/src/prov_adapter.cpp',
-                                               'sdk/mediator/src/ble_provisioning.cpp',
-                                               'sdk/mediator/src/provisioning.cpp'])
-       else :
-               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'])
+       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 == 'linux':
index 34328e3..f9c5bf0 100644 (file)
@@ -26,38 +26,22 @@ transport = enrollee_env.get('TARGET_TRANSPORT')
 ######################################################################
 # Build flags
 ######################################################################
-if 'BLE' in transport:
-       enrollee_env.PrependUnique(CPPPATH = [
-                '../../../../../resource/oc_logger/include',
-               '../../../../../resource/csdk/logger/include',
-                '../../../../../resource/csdk/stack/include',
-               '../../../../../extlibs/cjson',
-               '../../../sdk/common',
-               '../../../sdk/enrollee/arduino/ble',
-               '../../../sdk/enrollee/common/inc',
-               '../../../sdk/enrollee/common/src'
-               ])
-       enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESBLE'])     
-else : 
-       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/common/inc',
-               '../../../sdk/enrollee/common/src'
-               ])
-       enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
+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/common/inc',
+       '../../../sdk/enrollee/common/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'])
-if 'BLE' in transport:
-       enrollee = enrollee_env.Program('enrollee', 'enrollee_ble.cpp')
-else :
-       enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp')
+enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp')
 env.CreateBin('enrollee')
 
 i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)
diff --git a/service/easy-setup/sampleapp/enrollee/arduino/enrollee_ble.cpp b/service/easy-setup/sampleapp/enrollee/arduino/enrollee_ble.cpp
deleted file mode 100644 (file)
index 75481fb..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-// Do not remove the include below
-#include "Arduino.h"
-#include "logger.h"
-#include <string.h>
-#include "easysetup.h"
-
-const char *getResult(OCStackResult result);
-
-PROGMEM const char TAG[] = "ThinServer";
-
-void EventCallbackInApp(ESResult eventFlag)
-{
-    Serial.println("callback!!! in app");
-}
-
-// On Arduino Atmel boards with Harvard memory architecture, the stack grows
-// downwards from the top and the heap grows upwards. This method will print
-// the distance(in terms of bytes) between those two.
-// See here for more details :
-// http://www.atmel.com/webdoc/AVRLibcReferenceManual/malloc_1malloc_intro.html
-void PrintArduinoMemoryStats()
-{
-#ifdef ARDUINO_AVR_MEGA2560
-    //This var is declared in avr-libc/stdlib/malloc.c
-    //It keeps the largest address not allocated for heap
-    extern char *__brkval;
-    //address of tmp gives us the current stack boundry
-    int tmp;
-    OC_LOG_V(INFO, TAG, "Stack: %u         Heap: %u", (unsigned int)&tmp, (unsigned int)__brkval);
-    OC_LOG_V(INFO, TAG, "Unallocated Memory between heap and stack: %u",
-            ((unsigned int)&tmp - (unsigned int)__brkval));
-#endif
-}
-//The setup function is called once at startup of the sketch
-void setup()
-{
-    // Add your initialization code here
-    // Note : This will initialize Serial port on Arduino at 115200 bauds
-    OC_LOG_INIT();
-    OC_LOG(DEBUG, TAG, PCF("OCServer is starting..."));
-
-    if (InitEasySetup(ES_BLE, EventCallbackInApp) == ES_ERROR)
-    {
-        OC_LOG(ERROR, TAG, "EasySetup Init Failed");
-        return;
-    }
-
-    if (InitProvisioning(EventCallbackInApp) == ES_ERROR)
-    {
-        OC_LOG(ERROR, TAG, "Init Provisioning Failed");
-        return;
-    }
-}
-
-// The loop function is called in an endless loop
-void loop()
-{
-    // This artificial delay is kept here to avoid endless spinning
-    // of Arduino microcontroller. Modify it as per specific application needs.
-    delay(2000);
-
-    // This call displays the amount of free SRAM available on Arduino
-    PrintArduinoMemoryStats();
-
-    // Give CPU cycles to OCStack to perform send/recv and other OCStack stuff
-    if (OCProcess() != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, TAG, PCF("OCStack process error"));
-        return;
-    }
-}
index 68e32ce..4b4d4c5 100755 (executable)
@@ -4,12 +4,6 @@
     android:versionCode="1"
     android:versionName="1.0">
 
-    <uses-feature
-        android:name="android.hardware.bluetooth_le"
-        android:required="true" />
-
-    <uses-permission android:name="android.permission.BLUETOOTH" />
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
             android:label="@string/app_name">
 
             <intent-filter>
-                <action android:name="android.intent.action.SEND" />
-
-                <category android:name="android.intent.category.DEFAULT" />
-
-                <data android:mimeType="text/plain" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".BLEActivity" />
-        <activity android:name=".OnBoardingSelect">
-            <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
                 <category android:name="android.intent.category.LAUNCHER" />
diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/BLEActivity.java b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/BLEActivity.java
deleted file mode 100644 (file)
index be40bac..0000000
+++ /dev/null
@@ -1,284 +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;
-
-import java.io.IOException;
-
-import org.iotivity.service.easysetup.core.BleConnection;
-import org.iotivity.service.easysetup.core.EasySetupService;
-import org.iotivity.service.easysetup.core.EasySetupStatus;
-import org.iotivity.service.easysetup.core.EnrolleeDevice;
-import org.iotivity.service.easysetup.core.EnrolleeState;
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;
-import org.iotivity.service.easysetup.impl.WiFiProvConfig;
-
-import android.app.Activity;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothManager;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.ProgressBar;
-import android.widget.TextView;
-import android.widget.Toast;
-
-public class BLEActivity extends Activity {
-
-
-    /*Status to update the UI */
-    public static final int SUCCESS = 0;
-    public static final int FAILED = 1;
-    public static final int STATE_CHANGED = 2;
-
-    EditText mEnrolleeSsidText;
-    EditText mmEnrolleePasswordPassText;
-
-
-    TextView mDeviceNameTextView;
-    TextView mDeviceMacTextView;
-    TextView mDeviceUuidTextView;
-
-    TextView mResultTextView;
-    ProgressBar mProgressbar;
-    Button mStartButton;
-    Button mStopButton;
-    Handler mHandler = new ThreadHandler();
-
-    /**
-     * Objects to be instantiated by the programmer
-     */
-    WiFiProvConfig mWiFiProvConfig;
-    BLEOnBoardingConfig mBleOnBoardingConfig;
-    EasySetupService mEasySetupService;
-    EnrolleeDeviceFactory mDeviceFactory;
-    EnrolleeDevice mDevice;
-
-    private final int REQUEST_ENABLE_BT = 1;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_ble);
-
-        /* Initialize widgets to get user input for target network's SSID & password*/
-        mEnrolleeSsidText = (EditText) findViewById(R.id.enrolleeSsid);
-        mmEnrolleePasswordPassText = (EditText) findViewById(R.id.enrolleePass);
-        mDeviceNameTextView = (TextView) findViewById(R.id.devicename);
-        mDeviceMacTextView = (TextView) findViewById(R.id.hardAddr);
-        mDeviceUuidTextView = (TextView) findViewById(R.id.uuid);
-        mResultTextView = (TextView) findViewById(R.id.status);
-        mProgressbar = (ProgressBar) findViewById(R.id.progressBar);
-        mStartButton = (Button) findViewById(R.id.startSetup);
-        mStopButton = (Button) findViewById(R.id.stopSetup);
-
-        //default SSID and password
-        mEnrolleeSsidText.setText("hub2.4G");
-        mmEnrolleePasswordPassText.setText("11112222");
-
-       /* Create Easy Setup Service instance*/
-        mEasySetupService = EasySetupService.getInstance(getApplicationContext(),
-                new EasySetupStatus() {
-
-                    @Override
-                    public void onFinished(final EnrolleeDevice enrolledevice) {
-                        Log.i("BleActivity", "onFinished() is received " + enrolledevice
-                                .isSetupSuccessful());
-                        if (enrolledevice.isSetupSuccessful()) {
-                            mHandler.sendEmptyMessage(SUCCESS);
-                        } else {
-                            mHandler.sendEmptyMessage(FAILED);
-                        }
-                    }
-
-                    @Override
-                    public void onProgress(EnrolleeState state) {
-                        Log.i("MainActivity", "onProgress() is received ");
-                        mHandler.sendEmptyMessage(STATE_CHANGED);
-                    }
-
-                });
-
-        /* Create EnrolleeDevice Factory instance*/
-        mDeviceFactory = EnrolleeDeviceFactory.newInstance(getApplicationContext());
-
-        addListnerforStartES();
-        addListenerForStopES();
-
-
-    }
-
-    public void addListnerforStartES() {
-
-        mStartButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                mProgressbar.setVisibility(View.VISIBLE);
-                mProgressbar.setIndeterminate(true);
-                mStartButton.setEnabled(false);
-                mResultTextView.setText(R.string.running);
-                mStopButton.setEnabled(true);
-                start();
-            }
-        });
-    }
-
-    public void addListenerForStopES() {
-        mStopButton = (Button) findViewById(R.id.stopSetup);
-
-        mStopButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View arg0) {
-                mStartButton.setEnabled(true);
-                mStopButton.setEnabled(false);
-                mResultTextView.setText(R.string.stopped);
-                mProgressbar.setIndeterminate(false);
-                mProgressbar.setVisibility(View.INVISIBLE);
-                mEasySetupService.stopSetup(mDevice);
-            }
-        });
-    }
-
-
-    public WiFiProvConfig getEnrollerWifiConfig() {
-        /* Provide the credentials for the Mediator Soft AP to be connected by Enrollee*/
-        mWiFiProvConfig = new WiFiProvConfig(mEnrolleeSsidText.getText().toString(),
-                mmEnrolleePasswordPassText.getText().toString());
-        return mWiFiProvConfig;
-    }
-
-    public BLEOnBoardingConfig getOnBoardingWifiConfig() {
-        // Set the uuid of the OIC device here
-        mBleOnBoardingConfig = new BLEOnBoardingConfig();
-        /*
-        set the uuid of the OIC-device, so that the Easysetup API can find the device
-         */
-        mBleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");
-
-        return mBleOnBoardingConfig;
-    }
-
-
-    public void onDestroy() {
-        super.onDestroy();
-        /*Reset the Easy setup process*/
-        if (mEasySetupService != null) {
-            mEasySetupService.finish();
-        }
-    }
-
-    public void start() {
-        //This function starts the bluetooth adpater so that the easysetup can start scanning for BLE devices
-        final BluetoothManager bluetoothManager =
-                (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
-        BluetoothAdapter mBluetoothAdapter = bluetoothManager.getAdapter();
-
-        if (!mBluetoothAdapter.isEnabled()) {
-            //Bluetooth is disabled, enable it
-            Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
-            startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
-        } else try {
-            //IF bluetooth is directly enabled it will directly start the setup of enrollee devices
-
-                    /* Create a device using Factory instance*/
-            mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(),
-                    getEnrollerWifiConfig());
-            mEasySetupService.startSetup(mDevice);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        // User chose not to enable Bluetooth.
-        if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
-            Log.e("error bluetooth", "Bluetooth not enabled..Try again");
-            Toast.makeText(BLEActivity.this, "Bluetooth not enabled..Try again", Toast.LENGTH_SHORT).show();
-            return;
-        } else try {
-            //bluetooth is  enabled, now start the setup of enrollee devices
-                    /* Create a device using Factory instance*/
-            mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(),
-                    getEnrollerWifiConfig());
-            mEasySetupService.startSetup(mDevice);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        super.onActivityResult(requestCode, resultCode, data);
-    }
-
-
-    class ThreadHandler extends Handler {
-        @Override
-        public void handleMessage(Message msg) {
-
-            switch (msg.what) {
-                case SUCCESS: {
-
-                    mProgressbar.setIndeterminate(false);
-                    mStopButton.setEnabled(false);
-                    mStartButton.setEnabled(true);
-                    mProgressbar.setVisibility(View.INVISIBLE);
-                    String resultMsg = "Device configured successfully";
-                    mResultTextView.setText(R.string.success);
-
-                    /* Update device information on the Ui */
-                    BleConnection connection = (BleConnection) mDevice
-                            .getConnection();
-                    mDeviceNameTextView.setText(connection.getmDeviceName());
-                    mDeviceMacTextView.setText(connection.getMacaddress());
-                    mDeviceUuidTextView.setText(connection.getmServiceUUID());
-                    Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
-                    break;
-                }
-                case FAILED: {
-
-                    mProgressbar.setIndeterminate(false);
-                    mStopButton.setEnabled(false);
-                    mStartButton.setEnabled(true);
-                    mProgressbar.setVisibility(View.INVISIBLE);
-                    String resultMsg = "Device configuration failed";
-                    mResultTextView.setText(R.string.failed);
-                    Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
-                    break;
-                }
-
-                case STATE_CHANGED: {
-                    String resultMsg = "Device state changed";
-                    Toast.makeText(getApplicationContext(), resultMsg, Toast.LENGTH_SHORT).show();
-                    break;
-                }
-
-            }
-
-
-        }
-    }
-
-}
diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/OnBoardingSelect.java b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/OnBoardingSelect.java
deleted file mode 100644 (file)
index 66d6542..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.iotivity.service.easysetup;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.Button;
-import android.widget.RadioButton;
-import android.widget.Toast;
-
-public class OnBoardingSelect extends Activity {
-
-    RadioButton radio_wifi, radio_ble;
-    Button button_continue;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_on_boarding_select);
-
-        radio_wifi = (RadioButton) findViewById(R.id.radioWifi);
-        radio_ble = (RadioButton) findViewById(R.id.radioBle);
-        button_continue = (Button) findViewById(R.id.button_continue);
-
-        button_continue.setOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                Intent intent;
-                if (radio_wifi.isChecked())
-                    intent = new Intent(OnBoardingSelect.this, MainActivity.class);
-                else if (radio_ble.isChecked())
-                    intent = new Intent(OnBoardingSelect.this, BLEActivity.class);
-                else {
-
-                    Toast.makeText(OnBoardingSelect.this, "Please Select OnBoarding method " +
-                            "before Continuing", Toast.LENGTH_SHORT).show();
-                    return;
-                }
-                startActivity(intent);
-            }
-        });
-    }
-
-
-}
diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_ble.xml b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_ble.xml
deleted file mode 100644 (file)
index c60ab01..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@drawable/background"
-    android:orientation="vertical"
-    android:paddingBottom="@dimen/activity_vertical_margin"
-    android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
-    android:paddingTop="@dimen/activity_vertical_margin"
-    tools:context="org.iotivity.service.easysetup.BLEActivity">
-
-
-    <ProgressBar
-        android:id="@+id/progressBar"
-        style="?android:attr/progressBarStyleHorizontal"
-        android:layout_width="350dp"
-        android:layout_height="wrap_content"
-        android:visibility="invisible" />
-
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginTop="5dp"
-        android:orientation="horizontal">
-
-
-        <TextView
-            android:id="@+id/lablestatus"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="8dp"
-            android:layout_marginRight="20dp"
-            android:elegantTextHeight="true"
-            android:text="@string/test_status"
-            android:textSize="15sp" />
-
-        <TextView
-            android:id="@+id/status"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="30dp"
-            android:text="@string/not_started"
-            android:textColor="@android:color/background_light"
-            android:textSize="20dp" />
-
-    </LinearLayout>
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_gravity="center"
-        android:layout_marginTop="10dp"
-        android:orientation="vertical">
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="Enter Enroller's SSID" />
-
-
-        <EditText
-            android:id="@+id/enrolleeSsid"
-            android:layout_width="250dp"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal" />
-
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="10dp"
-            android:text="Enter Enroller's Password" />
-
-
-        <EditText
-            android:id="@+id/enrolleePass"
-            android:layout_width="250dp"
-            android:layout_height="wrap_content"
-
-            android:layout_gravity="center_horizontal" />
-
-    </LinearLayout>
-
-
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="5dp"
-        android:text="Device information"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
-
-    <RelativeLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_gravity="center"
-        android:layout_marginTop="10dp"
-        android:orientation="vertical">
-
-        <TextView
-            android:id="@+id/devicenamelabel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:text="Device Name:"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-        <TextView
-            android:id="@+id/devicename"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:layout_toRightOf="@id/devicenamelabel"
-            android:text="@string/not_available"
-
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-        <TextView
-            android:id="@+id/uuidLable"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/devicenamelabel"
-            android:layout_gravity="center_horizontal"
-            android:text="UUID:"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-        <TextView
-            android:id="@+id/uuid"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/devicename"
-            android:layout_gravity="center_horizontal"
-            android:layout_toRightOf="@id/uuidLable"
-            android:text="@string/not_available"
-
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-
-        <TextView
-            android:id="@+id/hardAddrLable"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/uuidLable"
-            android:layout_gravity="center_horizontal"
-            android:text="MAC Address:"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-        <TextView
-            android:id="@+id/hardAddr"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/uuid"
-            android:layout_gravity="center_horizontal"
-            android:layout_toRightOf="@id/hardAddrLable"
-            android:text="@string/not_available"
-            android:textAppearance="?android:attr/textAppearanceSmall" />
-
-
-    </RelativeLayout>
-
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_gravity="center"
-        android:layout_marginTop="20dp"
-        android:orientation="horizontal">
-
-        <Button
-            android:id="@+id/startSetup"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_centerHorizontal="true"
-            android:layout_margin="10dp"
-            android:layout_marginTop="20dp"
-            android:elegantTextHeight="true"
-            android:text="@string/startSetup"
-            android:textAllCaps="false"
-            android:textSize="18sp" />
-
-        <Button
-            android:id="@+id/stopSetup"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/startSetup"
-            android:layout_centerHorizontal="true"
-            android:layout_margin="10dp"
-            android:elegantTextHeight="true"
-            android:enabled="false"
-            android:text="@string/stopSetup"
-            android:textAllCaps="false"
-            android:textSize="18sp" />
-
-    </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_on_boarding_select.xml b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/layout/activity_on_boarding_select.xml
deleted file mode 100644 (file)
index 8fc9018..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@drawable/background"
-    android:paddingBottom="@dimen/activity_vertical_margin"
-    android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
-    android:paddingTop="@dimen/activity_vertical_margin"
-    tools:context="org.iotivity.service.easysetup.OnBoardingSelect">
-
-    <RadioGroup
-        android:id="@+id/radiotype"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_marginTop="75dp">
-
-        <RadioButton
-            android:id="@+id/radioWifi"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:checked="true"
-            android:text="Soft AP/WIFI" />
-
-        <RadioButton
-            android:id="@+id/radioBle"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="BLE" />
-
-    </RadioGroup>
-
-    <Button
-        android:id="@+id/button_continue"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_centerHorizontal="true"
-        android:layout_centerVertical="true"
-        android:text="Continue" />
-
-
-</RelativeLayout>
index 921b3c4..97c527e 100644 (file)
@@ -1,11 +1,11 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"\r
-    xmlns:app="http://schemas.android.com/apk/res-auto"\r
-    xmlns:tools="http://schemas.android.com/tools"\r
-    tools:context="org.iotivity.service.easysetup.MainActivity" >\r
-\r
-    <item\r
-        android:id="@+id/action_settings"\r
-        android:orderInCategory="100"\r
-        android:title="@string/action_settings"/>\r
-\r
-</menu>\r
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:context="org.iotivity.service.easysetup.MainActivity" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:title="@string/action_settings"/>
+
+</menu>
diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/menu/menu_ble.xml b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/res/menu/menu_ble.xml
deleted file mode 100644 (file)
index eb6d83e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:context="org.iotivity.service.easysetup.BLEActivity">
-    <item
-        android:id="@+id/action_settings"
-        android:orderInCategory="100"
-        android:showAsAction="never"
-        android:title="@string/action_settings" />
-</menu>
index 7f363cc..d6e8bea 100755 (executable)
@@ -44,10 +44,6 @@ static OCConnectivityType OC_CONNTYPE_BLE =  CT_ADAPTER_GATT_BTLE;
 static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.prov";
 static const char * UNICAST_PROV_STATUS_QUERY = "coap://%s:%d%s";
 
-static const char * UNICAST_PROVISIONING_QUERY_BLE = "coap://%s/oic/prov";
-static const char * MULTICAST_PROVISIONING_QUERY_BLE = "/oic/res?rt=oic.prov";
-
-
 /**
  * Attributes used to form a proper easysetup conforming JSON message.
  */
diff --git a/service/easy-setup/sdk/enrollee/arduino/ble/networkHandler.h b/service/easy-setup/sdk/enrollee/arduino/ble/networkHandler.h
deleted file mode 100644 (file)
index db02a42..0000000
+++ /dev/null
@@ -1,50 +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>
-
-#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)(ESResult);
-
-enum NetworkType
-{
-    ES_WIFI = 1, ES_BT = 2, ES_BLE = 3, ES_ZIGBEE = 4, ES_ETH = 5
-};
-typedef struct NETWORKINFO
-{
-    NetworkType type;
-    byte mac[6];
-} NetworkInfo;
-
-#endif
diff --git a/service/easy-setup/sdk/enrollee/common/src/easysetupble.cpp b/service/easy-setup/sdk/enrollee/common/src/easysetupble.cpp
deleted file mode 100644 (file)
index 4fcd952..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-//******************************************************************
-//
-// Copyright 2015 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include "easysetup.h"
-#include "logger.h"
-#include "resourceHandler.h"
-
-#define TAG "ES"
-
-int g_eventflag = 0;
-int g_cnt = 0;
-char *targetSsid;
-char *targetPass;
-
-EventCallback g_cbForProvisioning = NULL;
-EventCallback g_cbForOnboarding = NULL;
-
-void EventCallbackInOnboarding(ESResult event);
-void EventCallbackInProvisioning(ESResult event);
-void EventCallbackAfterProvisioning(ESResult event);
-
-void EventCallbackInOnboarding(ESResult event)
-{
-    if (event == ES_NETWORKFOUND || event == ES_NETWORKCONNECTED)
-    {
-        if (g_cbForOnboarding != NULL)
-        {
-            g_cbForOnboarding(event);
-        }
-    }
-}
-
-void EventCallbackInProvisioning(ESResult event)
-{
-    ESResult res = ES_OK;
-
-    if (event == ES_RECVTRIGGEROFPROVRES)
-    {
-        targetSsid = (char *) malloc(MAXSSIDLEN);
-        targetPass = (char *) malloc(MAXNETCREDLEN);
-
-        if (TerminateEasySetup() != OC_STACK_OK)
-        {
-            OC_LOG(ERROR, TAG, "Terminating stack failed");
-            return;
-        }
-
-        GetTargetNetworkInfoFromProvResource(targetSsid, targetPass);
-
-        OC_LOG(INFO, TAG, targetSsid);
-        OC_LOG(INFO, TAG, targetPass);
-        OC_LOG(INFO, TAG, "Device Provisioned");
-
-        // cannot connect to target network, as currently arduino supports only one transport at a time
-        //res = ConnectToWiFiNetwork(targetSsid, targetPass, EventCallbackAfterProvisioning);
-
-        if (g_cbForProvisioning != NULL)
-        {
-            g_cbForProvisioning(res);
-        }
-    }
-}
-
-void EventCallbackAfterProvisioning(ESResult event)
-{
-    if (event == ES_NETWORKFOUND || event == ES_NETWORKCONNECTED)
-    {
-        if (g_cbForProvisioning != NULL)
-        {
-            g_cbForProvisioning(event);
-        }
-    }
-}
-
-ESResult InitEasySetup(NetworkType networkType, EventCallback cb)
-{
-
-    // Initialize the OC Stack in Server mode
-    //if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
-    if (OCInit1(OC_SERVER, OC_DEFAULT_FLAGS, OC_DEFAULT_FLAGS) != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, TAG, "OCStack init error");
-        return ES_ERROR;
-    }
-    else
-    {
-        OC_LOG(DEBUG, TAG, "OCStack init success");
-        return ES_OK;
-    }
-}
-
-ESResult TerminateEasySetup()
-{
-    if (OCStop() != OC_STACK_OK)
-    {
-        OC_LOG(ERROR, TAG, "OCStack stop failed");
-        return ES_ERROR;
-    }
-    else
-    {
-        OC_LOG(ERROR, TAG, "OCStack stop success");
-        return ES_OK;
-    }
-}
-
-ESResult InitProvisioning(EventCallback cb)
-{
-    if (cb == NULL)
-    {
-        return ES_ERROR;
-    }
-    else
-    {
-        g_cbForProvisioning = cb;
-    }
-
-    if (CreateProvisioningResource() != OC_STACK_OK)
-    {
-        return ES_ERROR;
-    }
-
-    RegisterResourceEventCallBack( EventCallbackInProvisioning);
-
-    return ES_RESOURCECREATED;
-}
-
index fd9f645..1331f3a 100644 (file)
@@ -21,11 +21,8 @@ package org.iotivity.service.easysetup.core;
 \r
 import android.net.wifi.WifiConfiguration;\r
 import android.test.AndroidTestCase;\r
-import android.test.mock.MockApplication;\r
 import android.util.Log;\r
 \r
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;\r
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceBLEOnBoarding;\r
 import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;\r
 import org.iotivity.service.easysetup.impl.EnrolleeDeviceWiFiOnboarding;\r
 import org.iotivity.service.easysetup.impl.WiFiOnBoardingConfig;\r
@@ -160,145 +157,4 @@ public class EasySetupServiceTest extends AndroidTestCase {
 \r
     }\r
 \r
-    public void testStartSetupWithBleOnboarding() {\r
-\r
-        final String UUID = "ade3d529-c784-4f63-a987-eb69f70ee816";\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.BLE) {\r
-                        BleConnection conn = (BleConnection) enrolledevice.getConnection();\r
-                        String mac = conn.getMacaddress();\r
-                        if (mac == null || mac.isEmpty()) {\r
-                            assertTrue(false);\r
-                            return;\r
-                        }\r
-\r
-                        String uuid = conn.getmServiceUUID();\r
-                        if (uuid == null || uuid.isEmpty()) {\r
-                            assertTrue(false);\r
-                            return;\r
-                        }\r
-\r
-                        //  Conform that device are same\r
-                        if (!uuid.equals(UUID)) {\r
-                            assertTrue(false);\r
-                            return;\r
-                        }\r
-\r
-                        // Device configured successfully\r
-                        assertTrue(true);\r
-                    }\r
-\r
-                } else {\r
-                    assertTrue(false);\r
-                }\r
-            }\r
-\r
-            @Override\r
-            public void onProgress(EnrolleeState state) {\r
-                // TODO\r
-            }\r
-        });\r
-\r
-\r
-        /* Create On boarding configuration */\r
-\r
-        BLEOnBoardingConfig bleOnBoardingConfig = new BLEOnBoardingConfig();\r
-        bleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");\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(bleOnBoardingConfig, 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
-\r
-        /* Check if the the correct device is created as per the given configuration*/\r
-        assertTrue((mDevice instanceof EnrolleeDeviceBLEOnBoarding));\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
-\r
-            BleConnection conn = (BleConnection) mDevice.getConnection();\r
-            if (conn == null) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            String mac = conn.getMacaddress();\r
-            if (mac == null || mac.isEmpty()) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            String uuid = conn.getmServiceUUID();\r
-            if (uuid == null || uuid.isEmpty()) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            if (!uuid.equals(UUID)) {\r
-                assertTrue(false);\r
-                return;\r
-            }\r
-\r
-            Log.i("EasySetupTest", "MAC " + mac);\r
-            Log.i("EasySetupTest", "UUID " + uuid);\r
-\r
-            // Device configured successfully\r
-            assertTrue(true);\r
-\r
-        } catch (Exception e) {\r
-            e.printStackTrace();\r
-            assertTrue(false);\r
-        }\r
-\r
-    }\r
-\r
-\r
 }
\ No newline at end of file
index f8f826a..1c803d1 100644 (file)
@@ -25,8 +25,6 @@ package org.iotivity.service.easysetup.core;
 import android.net.wifi.WifiConfiguration;\r
 import android.test.AndroidTestCase;\r
 \r
-import org.iotivity.service.easysetup.impl.BLEOnBoardingConfig;\r
-import org.iotivity.service.easysetup.impl.EnrolleeDeviceBLEOnBoarding;\r
 import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;\r
 import org.iotivity.service.easysetup.impl.EnrolleeDeviceWiFiOnboarding;\r
 import org.iotivity.service.easysetup.impl.WiFiOnBoardingConfig;\r
@@ -74,27 +72,4 @@ public class EnrolleeDeviceFactoryTest extends AndroidTestCase {
 \r
     }\r
 \r
-    public void testNewEnrolleeDevice_with_BleOnboarding() {\r
-\r
-        /* Create On boarding configuration */\r
-\r
-        BLEOnBoardingConfig bleOnBoardingConfig = new BLEOnBoardingConfig();\r
-        bleOnBoardingConfig.setUuid("ade3d529-c784-4f63-a987-eb69f70ee816");\r
-\r
-        /* Create provisioning configuration */\r
-        WiFiProvConfig mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");\r
-\r
-        /* Create enrolling device */\r
-        EnrolleeDevice device = mFactory.newEnrolleeDevice(bleOnBoardingConfig, 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 EnrolleeDeviceBLEOnBoarding));\r
-\r
-    }\r
-\r
-\r
-\r
 }\r
index a77611d..64487cd 100644 (file)
@@ -1,17 +1,17 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"\r
-    package="org.iotivity.service.easysetup.mediator"\r
-    android:versionCode="1"\r
-    android:versionName="1.0" >\r
-\r
-    <uses-sdk\r
-        android:minSdkVersion="8"\r
-        android:targetSdkVersion="21" />\r
-\r
-    <application\r
-        android:allowBackup="true"\r
-        android:icon="@drawable/ic_launcher"\r
-        android:label="@string/app_name"\r
-        android:theme="@style/AppTheme" >\r
-    </application>\r
-\r
-</manifest>\r
+<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/BleConnection.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/core/BleConnection.java
deleted file mode 100755 (executable)
index eca0b18..0000000
+++ /dev/null
@@ -1,71 +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.core;
-
-public class BleConnection implements OnBoardingConnection {
-
-    private boolean mIsConnected;
-    private String mServiceUUID;
-    private String macaddress;
-    private String mDeviceName;
-
-    public void setConnectivity(boolean connected) {
-        mIsConnected = connected;
-    }
-
-    public void setmServiceUUID(String uuid) {
-        mServiceUUID = uuid;
-    }
-
-    public String getmServiceUUID() {
-        return mServiceUUID;
-    }
-
-    public void setMacaddress(String address) {
-        macaddress = address;
-    }
-
-    public String getMacaddress() {
-        return macaddress;
-    }
-
-    @Override
-    public String getDesc() {
-        return "Description";
-    }
-
-    @Override
-    public boolean isConnected() {
-        return mIsConnected;
-    }
-
-    @Override
-    public Object getConnection() {
-        return this;
-    }
-
-    public String getmDeviceName() {
-        return mDeviceName;
-    }
-
-    public void setmDeviceName(String mDeviceName) {
-        this.mDeviceName = mDeviceName;
-    }
-}
index ef1c5fd..ec3bd1b 100755 (executable)
@@ -26,7 +26,7 @@ package org.iotivity.service.easysetup.core;
  * 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, BLE, BT etc. the device is having.\r
+ * to the ON-BOARDING & PROVISION connectivity i.e. WiFi etc.\r
  */\r
 \r
 public abstract class EnrolleeDevice {\r
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/BLEOnBoardingConfig.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/BLEOnBoardingConfig.java
deleted file mode 100644 (file)
index 55a6214..0000000
+++ /dev/null
@@ -1,58 +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.impl;
-
-import org.iotivity.service.easysetup.core.OnBoardingConfig;
-
-import java.util.UUID;
-
-
-public class BLEOnBoardingConfig implements OnBoardingConfig {
-    private final ConnType mConnType = ConnType.BLE;
-    private String macaddress;
-    private UUID uuid;
-
-    @Override
-    public Object getConfig() {
-        return null;
-    }
-
-    @Override
-    public ConnType getConnType() {
-        return mConnType;
-    }
-
-
-    public UUID getUuid() {
-        return uuid;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = UUID.fromString(uuid);
-    }
-
-    public String getMacaddress() {
-        return macaddress;
-    }
-
-    public void setMacaddress(String macaddress) {
-        this.macaddress = macaddress;
-    }
-}
diff --git a/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceBLEOnBoarding.java b/service/easy-setup/sdk/mediator/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/impl/EnrolleeDeviceBLEOnBoarding.java
deleted file mode 100755 (executable)
index edbe845..0000000
+++ /dev/null
@@ -1,147 +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.impl;
-
-import android.content.Context;
-import android.util.Log;
-
-import org.iotivity.base.OcConnectivityType;
-import org.iotivity.service.easysetup.core.BleConnection;
-import org.iotivity.service.easysetup.core.OnBoardingConnection;
-import org.iotivity.service.easysetup.core.EnrolleeDevice;
-import org.iotivity.service.easysetup.core.EnrolleeState;
-import org.iotivity.service.easysetup.core.OnBoardingConfig;
-import org.iotivity.service.easysetup.core.ProvisioningConfig;
-import org.iotivity.service.easysetup.mediator.EasySetupManager;
-import org.iotivity.service.easysetup.mediator.EnrolleeInfo;
-import org.iotivity.service.easysetup.mediator.IOnBoardingStatus;
-import org.iotivity.service.easysetup.mediator.IProvisioningListener;
-import org.iotivity.service.easysetup.mediator.ProvisionEnrollee;
-import org.iotivity.service.easysetup.mediator.ble.BLEManager;
-
-public class EnrolleeDeviceBLEOnBoarding extends EnrolleeDevice {
-    /**
-     * @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
-     */
-    public static final String TAG = EnrolleeDeviceWiFiOnboarding.class.getName();
-
-    final Context mContext;
-    BLEManager bleManager;
-    EnrolleeInfo connectedDevice;
-    ProvisionEnrollee provisionEnrolleInstance;
-    private EasySetupManager easySetupManagerNativeInstance;
-
-
-    IOnBoardingStatus deviceScanListener = new IOnBoardingStatus() {
-
-        @Override
-        public void deviceOnBoardingStatus(EnrolleeInfo enrolleStatus) {
-            Log.d("ESBLEOnBoarding", "Entered");
-            if (enrolleStatus != null && enrolleStatus.getHWAddr() != null) {
-                String finalResult = "Easy Connect : ";
-
-                if (enrolleStatus.isReachable()) {
-                    finalResult = "Device OnBoarded" + "["
-                            + enrolleStatus.getHWAddr() + "]";
-                    connectedDevice = enrolleStatus;
-                    BleConnection conn = new BleConnection();
-                    conn.setMacaddress(connectedDevice.getHWAddr());
-                    conn.setConnectivity(true);
-                    conn.setmServiceUUID(connectedDevice.getIpAddr());
-                    conn.setmDeviceName(connectedDevice.getDevice());
-                    Log.d("ESBLEOnBoarding", "Entered" + ":" + finalResult);
-                    mOnBoardingCallback.onFinished(conn);
-                    return;
-
-                }
-            }
-
-            BleConnection conn = new BleConnection();
-            conn.setConnectivity(false);
-            mOnBoardingCallback.onFinished(conn);
-
-
-        }
-    };
-
-    protected EnrolleeDeviceBLEOnBoarding(Context context, OnBoardingConfig onBoardingConfig,
-                                          ProvisioningConfig provConfig) {
-        super(onBoardingConfig, provConfig);
-        mContext = context;
-        bleManager = new BLEManager(mContext, (BLEOnBoardingConfig) onBoardingConfig);
-    }
-
-    @Override
-    protected void startOnBoardingProcess() {
-        Log.i(TAG, "Starging on boarding process");
-
-        boolean status = bleManager.setupBluetooth();
-        mState = EnrolleeState.DEVICE_ON_BOARDING_STATE;
-        Log.i(TAG, "Bluetooth started with status " + status);
-        if (status) {
-            Log.i(TAG, "Scanning available BLE devices");
-            bleManager.startScan(deviceScanListener);
-
-        }
-
-    }
-
-    @Override
-    protected void stopOnBoardingProcess() {
-
-        if (bleManager != null)
-            bleManager.stopscan();
-
-    }
-
-    @Override
-    protected void startProvisioningProcess(OnBoardingConnection conn) {
-
-        Log.i("start provisioning BLE", mProvConfig.getConnType() + "");
-
-        mState = EnrolleeState.DEVICE_PROVISIONING_STATE;
-        provisionEnrolleInstance = new ProvisionEnrollee(mContext);
-        provisionEnrolleInstance.registerProvisioningHandler(new IProvisioningListener() {
-            @Override
-            public void onFinishProvisioning(int statuscode) {
-                mState = (statuscode == 0) ? EnrolleeState.DEVICE_PROVISIONING_SUCCESS_STATE :
-                        EnrolleeState.DEVICE_PROVISIONING_FAILED_STATE;
-                mProvisioningCallback.onFinished(EnrolleeDeviceBLEOnBoarding.this);
-            }
-        });
-
-        BleConnection connection = (BleConnection) conn;
-        WiFiProvConfig wifiProvConfig = (WiFiProvConfig) mProvConfig;
-        easySetupManagerNativeInstance = EasySetupManager.getInstance();
-        easySetupManagerNativeInstance.setApplicationContext(mContext);
-        easySetupManagerNativeInstance.initEasySetup();
-        Log.d("init", "successful");
-
-        easySetupManagerNativeInstance.provisionEnrollee(connection.getMacaddress(),
-                wifiProvConfig.getSsId(),
-                wifiProvConfig.getPassword(),
-                mOnBoardingConfig.getConnType().getValue());
-
-
-    }
-}
\ No newline at end of file
index 7e7ae72..905ecaf 100644 (file)
@@ -1,22 +1,22 @@
 /**
  * ***************************************************************
- * <p>
+ * <p/>
  * Copyright 2015 Samsung Electronics All Rights Reserved.
- * <p>
- * <p>
- * <p>
+ * <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>
+ * <p/>
  * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
+ * <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>
+ * <p/>
  * ****************************************************************
  */
 
@@ -59,16 +59,13 @@ public class EnrolleeDeviceFactory {
 
     public EnrolleeDevice newEnrolleeDevice(OnBoardingConfig onboardingConfig, ProvisioningConfig provConfig) {
 
-        EnrolleeDevice enrolleeDevice;
-        if (onboardingConfig.getConnType() == OnBoardingConfig.ConnType.WiFi) {
-            enrolleeDevice = new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
-        } else if (onboardingConfig.getConnType() == OnBoardingConfig.ConnType.BLE)
-            enrolleeDevice = new EnrolleeDeviceBLEOnBoarding(mContext, onboardingConfig, provConfig);
-
-        else {
+        if (onboardingConfig.getConnType() != OnBoardingConfig.ConnType.WiFi) {
             throw new IllegalArgumentException("OnBoarding configuration is not supported");
         }
 
+        EnrolleeDevice enrolleeDevice;
+        enrolleeDevice = new EnrolleeDeviceWiFiOnboarding(mContext, onboardingConfig, provConfig);
+
         return enrolleeDevice;
     }
 
index 05af933..be43a63 100755 (executable)
@@ -164,6 +164,7 @@ public class EnrolleeDeviceWiFiOnboarding extends EnrolleeDevice {
             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
index 60628dc..b704de5 100644 (file)
 #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();
+       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
+               *env,
+               jobject thisObj
 )
 {
-LOGI("JNI JNIInitEasySetup: Enter");
+       LOGI("JNI JNIInitEasySetup: Enter");
 
-InitProvProcess();
+       InitProvProcess();
 
-RegisterCallback(JNIProvisioningStatusCallback);
+       RegisterCallback(JNIProvisioningStatusCallback);
 }
 
 JNIEXPORT void JNICALL
 JNITerminateEasySetup(JNIEnv
-*env,
-jobject thisObj
+               *env,
+               jobject thisObj
 )
 {
-LOGI("JNI JNITerminateEasySetup: Enter");
+       LOGI("JNI JNITerminateEasySetup: Enter");
 
-ResetProvProcess();
+       ResetProvProcess();
 
 }
 
 JNIEXPORT void JNICALL
 JNIProvisionEnrollee(JNIEnv
-*env,
-jobject thisObj,
-        jstring
-jIPAddress,
-jstring jNetSSID,
-        jstring
-jNetPWD,
-jint jConnectivityType
+               *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_t 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;
-
-if(netInfo.connType==CT_ADAPTER_GATT_BTLE)
-{
-
-strncpy(netInfo
-.netAddressInfo.LE.leMacAddress,ipAddress,NET_MACADDR_SIZE-1);
-LOGI("MAC set=%s",netInfo.netAddressInfo.LE.leMacAddress);
-
-}
-netInfo.
-isSecured = true;
-
-StartProvisioning(&netInfo);
-
-return;
+       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_t 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)
+               *env,
+               jobject thisObj,
+               jint
+               jConnectivityType)
 {
-LOGI("JNI Stop Easy Setup: Entering");
+       LOGI("JNI Stop Easy Setup: Entering");
 
-StopProvisioning((OCConnectivityType) jConnectivityType);
+       StopProvisioning((OCConnectivityType)
+                       jConnectivityType);
 
-return;
+       return;
 }
 
diff --git a/service/easy-setup/sdk/mediator/src/ble_provisioning.cpp b/service/easy-setup/sdk/mediator/src/ble_provisioning.cpp
deleted file mode 100644 (file)
index e3adf8a..0000000
+++ /dev/null
@@ -1,195 +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.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-
-// NOTE : Keeping Ble provisioning in this file to have adaptability while doing OOPs refactoring 
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "ocpayload.h"
-#include "provisioning.h"
-#include "common.h"
-// External includes
-
-#include "logger.h"
-#include "oic_malloc.h"
-
-static bool sent_provision_request = false;
-
-static EnrolleeNWProvInfo_t *netProvInfo;
-
-/**
- * @var cbData
- * @brief Callback for providing provisioning status callback to application
- */
-static OCProvisioningStatusCB cbData = NULL;
-
-
-OCStackApplicationResult GetProvisioningStatusResponse(void *ctx, OCDoHandle handle,
-                                                       OCClientResponse *clientResponse) {
-
-    OIC_LOG_V(DEBUG, TAG, "INside  GetProvisioningStatusResponse");
-
-    // If user stopped the process then return from this function;
-    if (IsSetupStopped()) {
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        ClearMemory();
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    if (sent_provision_request == true)
-        return OC_STACK_DELETE_TRANSACTION;
-    sent_provision_request = true;
-
-    ProvisioningInfo *provInfo;
-
-    if (!ValidateEnrolleResponse(clientResponse)) {
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        ClearMemory();
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    OCRepPayload *input = (OCRepPayload * )(clientResponse->payload);
-
-    char query[OIC_STRING_MAX_VALUE] =
-            {'\0'};
-    char resURI[MAX_URI_LENGTH] =
-            {'\0'};
-
-    OIC_LOG_V(DEBUG, TAG, "resUri = %s", input->uri);
-
-    strncpy(resURI, input->uri, sizeof(resURI) - 1);
-
-    snprintf(query, sizeof(query), UNICAST_PROVISIONING_QUERY_BLE, clientResponse->addr->addr);
-
-    OIC_LOG_V(DEBUG, TAG, "query = %s", query);
-
-    OCDevAddr *devaddress = &clientResponse->devAddr;
-    devaddress->adapter = OC_ADAPTER_GATT_BTLE;
-
-    //OCPayloadLogRep(DEBUG,TAG,input);
-
-    if (ProvisionEnrollee(OC_HIGH_QOS, query, OC_RSRVD_ES_URI_PROV, devaddress,
-                          5  /* 5s delay to avoid packet drop*/) != OC_STACK_OK) {
-        OIC_LOG(INFO, TAG,
-                "GetProvisioningStatusResponse received NULL clientResponse.Invoking Provisioing Status Callback");
-
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        ClearMemory();
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    return OC_STACK_KEEP_TRANSACTION;
-
-}
-
-OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char *query,
-                                    const OCDevAddr *destination) {
-    OCStackResult ret = OC_STACK_ERROR;
-    OIC_LOG_V(INFO, TAG, "\n\nExecuting %s %d", __func__, destination->adapter);
-    ret = InvokeOCDoResource(query, OC_REST_GET, destination, OC_HIGH_QOS,
-                             GetProvisioningStatusResponse, NULL, NULL, 0);
-    return ret;
-}
-
-
-// This is a function called back when a device is discovered
-OCStackApplicationResult FindProvisioningResourceResponse(void *ctx, OCDoHandle handle,
-                                                          OCClientResponse *clientResponse) {
-
-    OIC_LOG(INFO, TAG, PCF("Entering FindProvisioningResourceResponse"));
-
-    // If user stopped the process then return from this function;
-    if (IsSetupStopped()) {
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        ClearMemory();
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    if (!ValidateFinddResourceResponse(clientResponse)) {
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    OCStackApplicationResult response = OC_STACK_DELETE_TRANSACTION;
-
-    ProvisioningInfo *provInfo;
-    char szQueryUri[64] =
-            {0};
-
-    OCDiscoveryPayload *discoveryPayload = (OCDiscoveryPayload * )(clientResponse->payload);
-
-    // Need to conform if below check is required or not. As Null check of clientResponse->payload is already performed above
-    if (!discoveryPayload) {
-        OIC_LOG_V(DEBUG, TAG, "Failed To parse");
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    OIC_LOG_V(DEBUG, TAG, "resUri = %s", discoveryPayload->resources->uri);
-
-    snprintf(szQueryUri, sizeof(szQueryUri), UNICAST_PROVISIONING_QUERY_BLE,
-             clientResponse->addr->addr);
-
-    OCDevAddr *devaddress = &clientResponse->devAddr;
-    devaddress->adapter = OC_ADAPTER_GATT_BTLE;
-
-    if (strcmp(netProvInfo->netAddressInfo.WIFI.ipAddress, clientResponse->devAddr.addr))
-        OIC_LOG_V(INFO, TAG, "unequal %s %s", netProvInfo->netAddressInfo.WIFI.ipAddress,
-                  clientResponse->devAddr.addr);
-    else
-        OIC_LOG_V(INFO, TAG, "unequal %s %s", netProvInfo->netAddressInfo.WIFI.ipAddress,
-                  clientResponse->devAddr.addr);
-
-    OIC_LOG_V(DEBUG, TAG, "query before GetProvisioningStatus call = %s %d", szQueryUri,
-              devaddress->adapter);
-
-    if (GetProvisioningStatus(OC_HIGH_QOS, szQueryUri, devaddress) != OC_STACK_OK) {
-        ErrorCallback(DEVICE_NOT_PROVISIONED);
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
-    return OC_STACK_KEEP_TRANSACTION;
-
-}
-
-bool ValidateEasySetupParams(const EnrolleeNWProvInfo_t *netInfo,
-                             OCProvisioningStatusCB provisioningStatusCallback) {
-
-    if (netInfo == NULL || strlen(netInfo->netAddressInfo.LE.leMacAddress) == 0) {
-        OIC_LOG(ERROR, TAG, "Request URI is NULL");
-        return false;
-    }
-
-    if (provisioningStatusCallback == NULL) {
-        OIC_LOG(ERROR, TAG, "ProvisioningStatusCallback is NULL");
-        return false;
-    }
-
-    return true;
-
-}
-
index bc71e4c..343b9c0 100755 (executable)
@@ -81,10 +81,6 @@ OCStackResult StartProvisioning(const EnrolleeNWProvInfo_t *netInfo) {
     if (netInfo->connType == CT_IP_USE_V4) {
         snprintf(findQuery, sizeof(findQuery), UNICAST_PROVISIONING_QUERY,
                  netInfo->netAddressInfo.WIFI.ipAddress, IP_PORT);
-    } else {
-
-        snprintf(findQuery, sizeof(findQuery),
-                 MULTICAST_PROVISIONING_QUERY_BLE);
     }
 
     return StartProvisioningProcess(netInfo, cbData, findQuery);