Added Multi PHY EasySetup Service
[platform/upstream/iotivity.git] / service / easy-setup / Build_Instructions_Android_Arduino.txt
1 === Prerequisites ===
2
3 * 1. Scons
4
5 Please refer to the following page to install scons:
6    http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install
7 (Note: on Windows, install Python 2.x before installing scons)
8
9 * 2. IDE/SDK Pre-requites
10 To build for some OS (Android / Arduino / IOS ...), an IDE/SDK may be required,
11 please go to the relative page to download and install the required IDE/SDK.
12
13 Note: Connectivity module building has been changed. We have to build connectivity
14       from the iotivity root folder.
15
16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 Android Build:
18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19 Steps to build and deploy Easysetup Mediator in Android platform
20 1) Compilation using Scons
21     0) Prerequisite exports for Android
22         export ANDROID_HOME=<ANDROID_HOME>
23         export ANDROID_NDK=<ANDROID_NDK>
24
25     a) In the IoTivity root source folder execute
26          scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
27
28     b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
29         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
30
31     c) Now navigate to the Easysetup NDK folder
32         <iotivity-root>/service/easy-setup/sdk/mediator/android
33
34     d) Execute NDK-Build with the following command to cross compiled Easysetup JNI .so files
35         <iotivity>/extlibs/android/ndk/android-ndk-r10d/ndk-build
36
37     e) Step (d) will generate cross compiled Easysetup JNI .so files in the following folder
38         <iotivity>/service/easy-setup/sdk/mediator/android/libs/armeabi
39
40 2) Compilation using Android Studio
41
42     0) Prerequisite for running the Android application
43         Install Android Studio and use the Android SDK manager to update the Android API to 21
44
45     a) Import following projects to the Studio using the "File->New->Import Project"
46         - service\easy-setup\sdk\android\EasySetupCore
47         - service\easy-setup\sampleapp\android\EasySetup
48
49     b) EasySetupCore is dependent on the .aar files generated in 1.b
50         1) To add an .aar file to the 'EasySetupCore' project,
51             a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
52             b.Select the .aar file(iotivity-armeabi-base-*.aar) from the location in steps 1.b
53             c.Right click on EasySetup->Open Module Settings
54             d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
55
56     c)    Build EasySetupCore project using "Android Studio->Build->Make Module "easySetupCore"
57         If the project is setup correctly, you should see a BUILD SUCCESSFUL in the Android Studio Gradle Build terminal
58             You should see the .aar file generated inside of
59             'iotivity\service\easy-setup\sdk\mediator\android\easySetupCore\build\outputs\aar'
60
61     d) EasySetup application is also dependent on the .so files generated in 1.d step
62         1) Drag and drop the following .so files in to the EasySetup\app\src\main\jniLibs\armeabi folder
63             - libeasysetup-jni.so [Easy Setup file]
64
65     e) EasySetup is also dependent on the .aar files generated in 1.b and 2.c steps
66         1) To add an .aar file to the 'EasySetup' project,
67             a.Right click on EasySetup->New->Module->Import .JAR or .AAR Package
68             b.Select the .aar file from the location in steps 1.b and 2.b above
69             c.Right click on EasySetup->Open Module Settings
70             d.Select each sample app module under 'Modules'->Dependencies->Add->Module Dependency
71             e.The .aar files (easySetupCore-*.aar & iotivity-armeabi-base-*.aar) selected in step 2.c.1.b above should be present. Select it.
72
73
74     e) Run "Easy Setup" as an Android application
75
76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77 Arduino Build:
78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79 Steps to build and deploy Easysetup Mediator in Arduino platform
80 1) Compilation using Scons for Arduino Due
81     a) Set up Arduino first before building. Refer to "connectivity\build\arduino\Arduino_Setup_README.txt" file for help.
82     b) Go to "iotivity/" folder.
83     c) Prerequisite exports for Arduino
84          export ARDUINO_HOME=<ARDUINO_HOME_DIR>
85     d) Start Arduino IDE. Select ""Tools->Port->Programming port"
86     e) scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI
87         - With debug or logging
88             scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
89         - With installation to Arduino
90             scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0 UPLOAD=true
91         NOTE: BOARD=arduino_due_x_dbg|arduino_due_x. Default is arduino_due_x_dbg.
92
93        Possible values for <transport> are:
94         -> IP :
95         $ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
96         -> BLE :
97         $ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=WIFI RELEASE=0
98
99         Note :- Only single transport can be built at a time for Arduino
100     f) The above command will build sample. The "enrollee.hex" can be found at "out/arduino/arm/release/service/easy-setup/sampleapp/enrollee/arduino"
101     g) After building sample, script will try to install on "/dev/ttyACM0" port in 'sudo' mode.
102         To skip installation, set command line argument 'UPLOAD=false' or without UPLOAD option
103     h) To set BLE Shield Name, include the option DEVICE_NAME during scons build.
104         -> $ scons TARGET_OS=arduino BOARD=arduino_due_x_dbg TARGET_ARCH=arm SHIELD=BLE RELEASE=0 DEVICE_NAME=OIC
105
106             Specified Device name length MUST be less than 10 characters. RBL Library has this limitation.
107             By Default DEVICE_NAME=OIC-DEVICE, if device name option is not specified
108
109             To change the port number, please modify  "port" variable in __upload() function in: "/build/arduino/SConscript".
110
111
112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
113 Folder structure:
114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++        
115
116 iotivity/
117 └── service
118     └── easy-setup/
119         │── SConscript
120         │── sdk
121         │    └── inc
122         │    └── src
123         │    └── android
124         │    └── arduino
125         │        └──wifi
126         │            └──inc
127         │            └──src
128         │── sampleapp
129         │    └──mediator/android
130         │    └──mediator/linux
131         │    └──enrollee/arduino
132         └── Build_Instructions_Android_Arduino.txt - You are reading this.