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 2) Compilation using Android Studio
63 0) Prerequisite for running the Android application
64 Install Android Studio and use the Android SDK manager to update the Android API to 21
66 a) Import following projects to the Studio using the "File->New->Import Project"
67 - service/easy-setup/mediator/richsdk/android/EasySetupCore
68 - service/easy-setup/sampleapp/android/EasySetup
70 b) EasySetupCore is dependent on the .aar files generated in 1.b
71 1) To add an .aar file to the 'EasySetupCore' project,
72 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
73 b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
74 c.Right click on EasySetup->Open Module Settings
75 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
77 c) Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
78 If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
79 You should see the .aar file generated inside of
80 'iotivity/service/easy-setup/mediator/richsdk/android/easySetupCore/build/outputs/aar'
82 d) EasySetup application is also dependent on the .so files generated in 1.d step
83 1) Drag and drop the following .so files in to the EasySetup/app/src/main/jniLibs/armeabi folder
84 - libeasysetup-jni.so [Easy Setup JNI library]
85 - libESMediatorRich.so [Easy Setup Mediator library]
87 e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
88 1) To add an .aar file to the 'EasySetup' project,
89 a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
90 b.Select the .aar file from the location in steps 1.b and 2.b above
91 c.Right click on EasySetup->Open Module Settings
92 d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
93 e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
96 e) Run "Easy Setup" as an Android application
98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
101 Steps to build and deploy Easysetup Mediator in Arduino platform
102 1) Compilation using Scons for Arduino Due
103 a) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
104 b) Go to "iotivity/" folder.
105 c) Prerequisite exports for Arduino
106 export ARDUINO_HOME=<ARDUINO_HOME_DIR>
107 d) Start Arduino IDE. Select ""Tools->Port->Programming port"
108 e) scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI
109 - With debug or logging
110 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
111 - With installation to Arduino
112 scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0 UPLOAD=true
113 NOTE: 1) BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
114 2) For Mega board, please use the following options. BOARD=mega & TARGET_ARCH=avr
116 Possible values for <transport> are: [Only ip is currently supported]
118 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI ES_ROLE=enrollee RELEASE=0
120 $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 [Currently not supporting]
122 Note :- Only single transport can be built at a time for Arduino
123 f) The above command will build sample. The "enrollee.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/enrollee/arduino"
124 g) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
125 To skip installation, set command line argument 'UPLOAD=false' or without UPLOAD option
126 h) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
127 -> $ scons service TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 DEVICE_NAME=OIC
129 Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
130 By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
132 To change the port number, please modify "port" variable in __upload() function in: "/build/arduino/SConscript".
135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
164 │ └──mediator/android
166 │ └──enrollee/arduino
169 │ └──enrollee/tizen-sdb
171 └── Build_Instructions_Android_Arduino.txt - You are reading this.