1 #******************************************************************
3 # Copyright 2016 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
25 Please refer to the following page to install scons:
26 http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
27 (Note: on Windows, install Python 2.x before installing scons)
29 * 2. IDE/SDK Pre-requites
30 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
31 please go to the relative page to download and install the required IDE/SDK.
33 Note: Connectivity module building has been changed. We have to build connectivity
34 from the iotivity root folder.
36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 Steps to build and deploy Easysetup Mediator in Android platform
40 1) Compilation using Scons
41 0) Prerequisite exports for Android
42 export ANDROID_HOME=<ANDROID_HOME>
43 export ANDROID_NDK=<ANDROID_NDK>
45 a) In the IoTivity root source folder execute
46 scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
48 b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
49 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
51 c) Now navigate to the Easysetup NDK folder
52 <iotivity-root>/service/easy-setup/mediator/richsdk/android
54 d) Execute NDK-Build with the following command to cross compiled Easysetup JNI .so files
55 <iotivity>/extlibs/android/ndk/android-ndk-r10d/ndk-build
57 e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
58 <iotivity>/service/easy-setup/mediator/richsdk/android/libs/armeabi
60 NOTE: If you are going to use the SECURITY feature :
62 (a) please remove the "oic_svr_db_client.dat" file from the application (EasySetup/app/src/main/assets/)
64 (b) Copy the same file in the same folder from : <iotivity>/resource/csdk/security/provisioning/sample/oic_svr_db_client.dat
66 2) Compilation using Android Studio
68 0) Prerequisite for running the Android application
69 Install Android Studio and use the Android SDK manager to update the Android API to 21
71 a) Import following projects to the Studio using the "File->New->Import Project"
72 - service/easy-setup/mediator/richsdk/android/EasySetupCore
73 - service/easy-setup/sampleapp/android/EasySetup
75 b) EasySetupCore is dependent on the .aar files generated in 1.b
76 1) To add an .aar file to the 'EasySetupCore' project,
77 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
78 b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
79 c.Right click on EasySetup->Open Module Settings
80 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
82 c) Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
83 If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
84 You should see the .aar file generated inside of
85 'iotivity/service/easy-setup/mediator/richsdk/android/easySetupCore/build/outputs/aar'
87 d) EasySetup application is also dependent on the .so files generated in 1.d step
88 1) Drag and drop the following .so files in to the EasySetup/app/src/main/jniLibs/armeabi folder
89 - libeasysetup-jni.so [Easy Setup JNI library]
90 - libESMediatorRich.so [Easy Setup Mediator library]
92 e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
93 1) To add an .aar file to the 'EasySetup' project,
94 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
95 b.Select the .aar file from the location in steps 1.b and 2.b above
96 c.Right click on EasySetup->Open Module Settings
97 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
98 e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
101 e) Run "Easy Setup" as an Android application
103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
106 Steps to build and deploy Easysetup Mediator in Arduino platform
107 1) Compilation using Scons for Arduino Due
108 a) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
109 b) Go to "iotivity/" folder.
110 c) Prerequisite exports for Arduino
111 export ARDUINO_HOME=<ARDUINO_HOME_DIR>
112 d) Start Arduino IDE. Select ""Tools->Port->Programming port"
113 e) scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI
114 - With debug or logging
115 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
116 - With installation to Arduino
117 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0 UPLOAD=true
118 NOTE: 1) BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
119 2) For Mega board, please use the following options. BOARD=mega & TARGET_ARCH=avr
121 Possible values for <transport> are: [Only ip is currently supported]
123 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
125 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 [Currently not supporting]
127 Note :- Only single transport can be built at a time for Arduino
128 f) The above command will build sample. The "enrollee.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/enrollee/arduino"
129 g) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
130 To skip installation, set command line argument 'UPLOAD=false' or without UPLOAD option
131 h) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
132 -> $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 DEVICE_NAME=OIC
134 Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
135 By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
137 To change the port number, please modify "port" variable in __upload() function in: "/build/arduino/SConscript".
140 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169 │ └──mediator/android
171 │ └──enrollee/arduino
174 │ └──enrollee/tizen-sdb
176 └── Build_Instructions_Android_Arduino.txt - You are reading this.