Commit ef90213c authored by Madan Lanka's avatar Madan Lanka Committed by Uze Choi

Removed Eesysetup implementation for validation

Removed Easysetup implementation due to pending internal code validation step.
The support will be added after validation is completed

Change-Id: I8cc1499a1d033ed0eeb5cfff1ceb0c729e2968d4
Signed-off-by: default avatarMadan Lanka <lanka.madan@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2611Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Tested-by: default avatarUze Choi <uzchoi@samsung.com>
parent 294f15f3
......@@ -41,9 +41,6 @@ if target_os not in ['arduino','darwin']:
# Build notification manager project
SConscript('notification-manager/SConscript')
if target_os in ['arduino','android', 'linux']:
SConscript('easy-setup/SConscript')
# Build resource-encapsulation project
if target_os not in ['tizen']:
SConscript('resource-encapsulation/SConscript')
......
=== Prerequisites ===
* 1. Scons
Please refer to the following page to install scons:
http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
(Note: on Windows, install Python 2.x before installing scons)
* 2. IDE/SDK Pre-requites
To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
please go to the relative page to download and install the required IDE/SDK.
Note: Connectivity module building has been changed. We have to build connectivity
from the iotivity root folder.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Android Build:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Steps to build and deploy Easysetup Mediator in Android platform
1) Compilation using Scons
0) Prerequisite exports for Android
export ANDROID_HOME=<ANDROID_HOME>
export ANDROID_NDK=<ANDROID_NDK>
a) In the IoTivity root source folder execute
scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
You should see the .aar files generated inside of '<iotivity>/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
c) Now navigate to the Easysetup NDK folder
<iotivity-root>/service/easy-setup/sdk/mediator/android
d) Execute NDK-Build with the following command to cross compiled Easysetup JNI .so files
~/madan/android-ndk-r10d/ndk-build
e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
2) Compilation using Android Studio
0) Prerequisite for running the Android application
Install Android Studio and use the Android SDK manager to update the Android API to 21
a) Import following projects to the Studio using the "File->New->Import Project"
- service\easy-setup\sdk\android\EasySetupCore
- service\easy-setup\sampleapp\android\EasySetup
b) EasySetupCore is dependent on the .aar files generated in 1.b
1) To add an .aar file to the 'EasySetupCore' project,
a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
c.Right click on EasySetup->Open Module Settings
d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
c) Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
You should see the .aar file generated inside of
'iotivity\service\easy-setup\sdk\mediator\android\easySetupCore\build\outputs\aar'
d) EasySetup application is also dependent on the .so files generated in 1.d step
1) Drag and drop the following .so files in to the EasySetup\app\src\main\jniLibs\armeabi folder
- libeasysetup-jni.so [Easy Setup file]
e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
1) To add an .aar file to the 'EasySetup' project,
a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
b.Select the .aar file from the location in steps 1.b and 2.b above
c.Right click on EasySetup->Open Module Settings
d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
e) Run "Easy Setup" as an Android application
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Arduino Build:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Steps to build and deploy Easysetup Mediator in Arduino platform
1) Compilation using Scons for Arduino Due
a) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
b) Go to "iotivity/" folder.
c) Prerequisite exports for Arduino
export ARDUINO_HOME=<ARDUINO_HOME_DIR>
d) Start Arduino IDE. Select ""Tools->Port->Programming port"
e) scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI
- With debug or logging
scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
- With installation to Arduino
scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0 UPLOAD=true
NOTE: BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
Possible values for <transport> are:
-> IP :
$ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
-> BLE :
$ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
Note :- Only single transport can be built at a time for Arduino
f) The above command will build sample. The "thinserver.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/arduino/thinserver/"
g) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
To skip installation, set command line argument 'UPLOAD=false' or without UPLOAD option
h) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
-> $ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 DEVICE_NAME=OIC
Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
To change the port number, please modify "port" variable in __upload() function in: "/build/arduino/SConscript".
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Folder structure:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
iotivity/
└── service
└── easy-setup/
│── SConscript
│── sdk
│ └── inc
│ └── src
│ └── android
│ └── arduino
│ └──wifi
│ └──inc
│ └──src
│── sampleapp
│ └──android
│ └──arduino
│ └──linux
└── Build_Instructions_Android_Arduino.txt - You are reading this.
\ No newline at end of file
#******************************************************************
#
# 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.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
# easy-setup project build script
##
import os
Import('env')
env.AppendUnique(CPPDEFINES = ['EASY_SETUP_CA_INIT'])
easy_setup_env = env.Clone()
target_os = env.get('TARGET_OS')
lib_env = env.Clone()
if target_os == 'android':
SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', exports = 'lib_env')
######################################################################
# Build flags
######################################################################
easy_setup_env.AppendUnique(CPPPATH = ['sdk/inc', 'sdk/src', 'sdk/common'])
if target_os not in ['windows', 'winrt']:
easy_setup_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall'])
if target_os not in ['android', 'arduino']:
easy_setup_env.AppendUnique(CXXFLAGS = ['-pthread'])
if target_os in ['android', 'linux']:
easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
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 target_os == 'arduino':
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'])
if target_os in ['android','linux']:
easy_setup_env.PrependUnique(CPPPATH = [
env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
env.get('SRC_DIR') + '/resource/csdk/connectivity/common/inc',
env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
env.get('SRC_DIR') + '/resource/csdk/stack/include',
env.get('SRC_DIR') + '/resource/csdk/logger/include',
env.get('SRC_DIR') + '/resource/csdk/security/include',
env.get('SRC_DIR') + '/extlibs/cjson',
'sdk/common',
'sdk/mediator/inc'])
######################################################################
# Source files and Targets
######################################################################
if target_os == 'arduino':
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':
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/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
SConscript('sampleapp/SConscript')
#******************************************************************
#
# 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.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
# sampleapp build script
##
Import('env')
# Add third party libraries
lib_env = env.Clone()
sample_env = lib_env.Clone()
target_os = env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
######################################################################
# Source files and Targets
######################################################################
if target_os == 'arduino' :
# Build linux sample app
SConscript('arduino/thinserver/SConscript')
if target_os == 'linux' :
# Build linux sample app
SConscript('linux/richclient/SConscript')
#built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Windows thumbnail db
Thumbs.db
# OSX files
.DS_Store
# Eclipse project files
.classpath
.project
#Android Studio & Gradle
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build/*
/base/build/*
/base/obj/*
/base/libs/*
/sample/*
#Some older projects
/*/out
/*/*/build
/*/*/production
*.iws
*.ipr
*~
*.swp
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="EasySetupGradle" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="false" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "org.iotivity.service.easysetup"
minSdkVersion 21
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.iotivity.service.easysetup"
android:versionCode="1"
android:versionName="1.0" >
<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" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<uses-feature android:name="android.permission.CONNECTIVITY_INTERNAL" android:required="true"/>
<uses-permission android:name="android.permission.CAMERA"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
</application>
</manifest>
/**
* ***************************************************************
* <p/>
* Copyright 2015 Samsung Electronics All Rights Reserved.
* <p/>
* <p/>
* <p/>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* <p/>
* ****************************************************************
*/
package org.iotivity.service.easysetup;
import java.io.IOException;
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.core.IpOnBoardingConnection;
import org.iotivity.service.easysetup.impl.EnrolleeDeviceFactory;
import org.iotivity.service.easysetup.impl.WiFiOnBoardingConfig;
import org.iotivity.service.easysetup.impl.WiFiProvConfig;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.wifi.WifiConfiguration;
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.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity 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;
static final int REQUEST_IMAGE_CAPTURE = 1;
ImageView imageView;
EditText mSsidText;
EditText mPassText;
EditText mEnrolleeSsidText;
EditText mmEnrolleePasswordPassText;
TextView mDeviceIpTextView;
TextView mDeviceMacTextView;
TextView mResultTextView;
ProgressBar mProgressbar;
Button mStartButton;
Button mStopButton;
Handler mHandler = new ThreadHandler();
/**
* Objects to be instantiated by the programmer
*/
WiFiProvConfig mWiFiProvConfig;
WiFiOnBoardingConfig mWiFiOnBoardingConfig;
EasySetupService mEasySetupService;
EnrolleeDeviceFactory mDeviceFactory;
EnrolleeDevice mDevice;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/* Initialize widgets to get user input for target network's SSID & password*/
mSsidText = (EditText) findViewById(R.id.ssid);
mPassText = (EditText) findViewById(R.id.password);
mEnrolleeSsidText = (EditText) findViewById(R.id.enrolleeSsid);
mmEnrolleePasswordPassText = (EditText) findViewById(R.id.enrolleePass);
mDeviceIpTextView = (TextView) findViewById(R.id.ipAddr);
mDeviceMacTextView = (TextView) findViewById(R.id.hardAddr);
mResultTextView = (TextView) findViewById(R.id.status);
mProgressbar = (ProgressBar) findViewById(R.id.progressBar);
/* Create Easy Setup Service instance*/
mEasySetupService = EasySetupService.getInstance(getApplicationContext(),
new EasySetupStatus() {
@Override
public void onFinished(final EnrolleeDevice enrolledevice) {
Log.i("MainActivity", "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());
/* Create a device using Factory instance*/
mDevice = mDeviceFactory.newEnrolleeDevice(getOnBoardingWifiConfig(),
getEnrollerWifiConfig());
addListenerForStartAP();
addListenerForStopAP();
}
public WiFiProvConfig getEnrollerWifiConfig() {
/* Provide the credentials for the Mediator Soft AP to be connected by Enrollee*/
mWiFiProvConfig = new WiFiProvConfig("hub2.4G", "11112222");