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 ES_ROLE=mediator ES_TARGET_ENROLLEE={Platform} RELEASE=0
47 Note : {Platform} can be -> arduino , linux, tizen
49 b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
50 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
52 c) Now navigate to the Easysetup NDK folder
53 <iotivity-root>/service/easy-setup/mediator/richsdk/android
55 d) Execute NDK-Build with the following command to cross compiled Easysetup JNI .so files
56 <iotivity>/extlibs/android/ndk/android-ndk-r10d/ndk-build
58 e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
59 <iotivity>/service/easy-setup/mediator/richsdk/android/libs/armeabi
61 NOTE: If you are going to use the SECURITY feature :
63 (a) please remove the "oic_svr_db_client.dat" file from the application (EasySetup/app/src/main/assets/)
65 (b) Copy the same file in the same folder from : <iotivity>/resource/csdk/security/provisioning/sample/oic_svr_db_client.dat
67 2) Compilation using Android Studio
69 0) Prerequisite for running the Android application
70 Install Android Studio and use the Android SDK manager to update the Android API to 21
72 a) Import following projects to the Studio using the "File->New->Import Project"
73 - service/easy-setup/mediator/richsdk/android/EasySetupCore
74 - service/easy-setup/sampleapp/android/EasySetup
76 b) EasySetupCore is dependent on the .aar files generated in 1.b
77 1) To add an .aar file to the 'EasySetupCore' project,
78 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
79 b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
80 c.Right click on EasySetup->Open Module Settings
81 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
83 c) Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
84 If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
85 You should see the .aar file generated inside of
86 'iotivity/service/easy-setup/mediator/richsdk/android/easySetupCore/build/outputs/aar'
88 d) EasySetup application is also dependent on the .so files generated in 1.d step
89 1) Drag and drop the following .so files in to the EasySetup/app/src/main/jniLibs/armeabi folder
90 - libeasysetup-jni.so [Easy Setup JNI library]
91 - libESMediatorRich.so [Easy Setup Mediator library]
93 e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
94 1) To add an .aar file to the 'EasySetup' project,
95 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
96 b.Select the .aar file from the location in steps 1.b and 2.b above
97 c.Right click on EasySetup->Open Module Settings
98 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
99 e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
102 e) Run "Easy Setup" as an Android application
104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
107 Steps to build and deploy Easysetup Mediator in Arduino platform
108 1) Compilation using Scons for Arduino Due
109 a) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
110 b) Go to "iotivity/" folder.
111 c) Prerequisite exports for Arduino
112 export ARDUINO_HOME=<ARDUINO_HOME_DIR>
113 d) Start Arduino IDE. Select ""Tools->Port->Programming port"
114 e) scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI
115 - With debug or logging
116 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
117 - With installation to Arduino
118 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0 UPLOAD=true
119 NOTE: 1) BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
120 2) For Mega board, please use the following options. BOARD=mega & TARGET_ARCH=avr
122 Possible values for <transport> are: [Only ip is currently supported]
124 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI ES_ROLE=enrollee RELEASE=0
126 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 [Currently not supporting]
128 Note :- Only single transport can be built at a time for Arduino
129 f) The above command will build sample. The "enrollee.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/enrollee/arduino"
130 g) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
131 To skip installation, set command line argument 'UPLOAD=false' or without UPLOAD option
132 h) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
133 -> $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 DEVICE_NAME=OIC
135 Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
136 By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
138 To change the port number, please modify "port" variable in __upload() function in: "/build/arduino/SConscript".
141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
170 │ └──mediator/android
172 │ └──enrollee/arduino
175 │ └──enrollee/tizen-sdb
177 └── Build_Instructions_Android_Arduino.txt - You are reading this.