1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
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 ******************************************************************/
22 ===============================================================================
23 == How to Build SoftSensorManager ==
24 ===============================================================================
26 Once the source code is downloaded in your local specific folder, you may follow
27 the steps to build and execute Soft Sensor Manager and its applications.
28 In this context, we assume that the code was downloaded into 'oic' folder.
31 =======================================
32 1. Download source code
33 =======================================
35 Once you download the codes, please make sure that the downloaded code structure is as follows;
42 The path for Soft Sensor Manager is as following;
44 oic/service/soft-sensor-manager
46 The SoftSensorManager directory includes following sub directories;
48 Directories Description
49 oic/service/soft-sensor-manager/build : There are makefiles for different platform; Linux, Tizen, and Arduino.
50 oic/service/soft-sensor-manager/doc : SSM developer's guide and Getting started documents
51 oic/service/soft-sensor-manager/SampleApp : There are two types of sample applications; application for UI, and application for physical sensors.
52 For UI application, there are SSMTesterApp in /linux, and /Tizen.
54 1) Temperature and Humidity sensors, THSensorApp, in \linux and \arduino.
55 In the two directories, in \linux and \arduino , there are two TemperaterHumiditySensor applications,
56 THSensorApp and THSensorApp1, and they are for DiscomfortSoftSensor which aggregates
57 two TemperaterHumiditySensors to calculate current discomfort index in the given room.
58 2) Trackee_Thing for IndoorTrajectorySensor in \linux and \arduino
60 oic/service/soft-sensor-manager/SDK : The SDK APIs for applications is located.
61 oic/service/soft-sensor-manager/SSMCore : The SSM service codes
62 oic/service/soft-sensor-manager/SoftSensorPlugin : The source codes for soft sensors can be located in this folder.
63 Examples of soft sensors are DiscomfortIndexSensor and IndoorTrajectorySensor.
66 =======================================
67 2. Refer readme files in each build
68 directory for each module.
69 =======================================
70 There are readme files in the build directories for each module (e.g. \SDK, \ SSMCore, \SampleApp).
71 Please refer the files for specific setup.
74 =======================================
76 =======================================
78 3.1 Run make for SoftSensorManager & App in Ubuntu.
80 3.1.1 Before running make for SoftSensorManager & App in Ubuntu, resource should be built in advance.
81 Please refer to ¡®Build the IoTivity project for Linux¡¯ in previous section
83 3.1.2 If you type "make" at ¡°soft-sensor-manager/build/linux¡±, all packages will be pushed to "/soft-sensor-manager/build/linux/release".
84 You can also found other packages in the folder
86 +--------------------------------------------------------------+
87 | ~/oic/service/soft-sensor-manager/build/linux$ make |
88 +--------------------------------------------------------------+
90 3.2 Run make for App in Arduino
92 3.2.1 If you want to build for Arduino, download Arduino IDE (Arduino 1.0.6) from following url.
93 Extract ¡®arduino-1.0.6-linux32.tgz¡¯ and change folder name from ¡®arduino-1.0.6¡¯ to ¡®arduino¡¯ and then move to "/usr/share/".
94 url: http://arduino.cc/en/Main/Software
96 +--------------------------------------------------------------------+
97 | $ mv arduino-1.0.6 arduino |
98 | $ sudo cp -Rdp ./arduino /usr/share/ |
99 +--------------------------------------------------------------------+
101 3.2.2 Download Time library (Time.zip, Click ¡°The download¡±) from following url.
102 Unzip Time.zip and move them to /usr/share/arduino/libraries.
103 url: http://playground.arduino.cc/Code/Time
105 +--------------------------------------------------------------------+
106 | $ sudo cp -Rdp ./Time /usr/share/arduino/libraries/ |
107 +--------------------------------------------------------------------+
109 3.2.3 Create file named ¡®local.properties¡¯ in ¡°/oic/resource/csdk/¡± with the following definitions.
111 +------------------------------------------------------------------------------------+
112 | < local.properties > |
113 | ARDUINO_DIR = /usr/share/arduino |
114 | ARDUINO_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr/bin |
115 +------------------------------------------------------------------------------------+
116 If you have a problem with compiling ¡®resource¡¯ when you compile arduino application,
117 you may need to check 'local.properties' which is written in the readme file, '/oic/resource/csdk/README'.
119 3.2.4 Before running make for application, you need to build resource with arduino platform first.
120 Please refer to below example.
122 +------------------------------------------------------------------------------------------+
123 | ~/oic/resource/csdk$ make PLATFORM=arduinomega ARDUINOWIFI=1 |
124 +------------------------------------------------------------------------------------------+
125 PLATFORM : arduinomega or arduinodue.
126 ARDUINOWIFI : 0 (Ethernet), 1(Wifi)
128 3.2.5 Now, you are ready to build sample arduino application.
129 To build all sample applications for arduino, just do as below.
131 +------------------------------------------------------------------------------------------------+
132 |~/oic/service/soft-sensor-manager/ build/Arduino$ make PLATFORM=arduinomega ARDUINOWIFI=1 |
133 +------------------------------------------------------------------------------------------------+
135 If you want to build each sample application separately, go to build directory for sample application.
136 Belowing is example for THSensor App.
138 +-------------------------------------------------------------------------------------------------------------------+
139 |~/oic/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build$ make PLATFORM=arduinomega ARDUINOWIFI=1 |
140 +-------------------------------------------------------------------------------------------------------------------+
142 3.2.6. To build and deploy the binary into the target hardware board, Aruino in this case, you need 'install' option.
143 Please refer to below example for THSensorApp;
145 +--------------------------------------------------------------------------------------------------------------------------+
146 |~/oic/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build$ make install PLATFORM=arduinomega ARDUINOWIFI=1 |
147 +--------------------------------------------------------------------------------------------------------------------------+
148 Before ¡®make install¡¯, you need to check the file located at "/oic/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/Makefile".
149 Line 26, ARDUINO_PORT is the serial port path, which has to be aligned on your system.
152 =======================================
153 4. Execute THSensorApp and SSMTesterApp
154 =======================================
156 If you want to check how soft-sensor-manager is working, you can run simple applications - THSensorApp and SSMTesterApp
158 4.1 To initiate THSensorApp, please enter as following;
160 +------------------------------------------------------------------------+
161 |~/oic/service/soft-sensor-manager/build/linux/release$ ./THSensorApp |
162 |~/oic/service/soft-sensor-manager/build/linux/release$ ./THSensorApp1 |
163 +------------------------------------------------------------------------+
165 4.2 To initiate SSMTesterApp, please enter as following;
167 +--------------------------------------------------------------------------+
168 |~/oic/service/soft-sensor-manager/build/linux/release$ ./SSMTesterApp |
169 +--------------------------------------------------------------------------+
171 Note that the sequence of process initiations should be followed due to the process dependencies.
174 =======================================
176 =======================================
178 If you want to use Scons to build soft-sensor-manager, build the source code and execute sample applications as following steps.
180 5.1 After downloading the source codes, type "scons" at project root directory "oic/"
182 +---------------------------------------+
184 +---------------------------------------+
186 5.2 To execute Soft Sensor Manager and its applications, some shared libraries must be exported.
188 5.2.1 Go to "oic/out/<target_os>/<target_arch>/release", and check if there are following .so files
193 5.2.2 To export the shared libraries, please enter as following;
195 +---------------------------------------------------------------------------------------------------------------------------+
196 |~/oic/out/<target_os>/<target_arch>/release$ export LD_LIBRARY_PATH=~/oic/out/<target_os>/<target_arch>/release |
197 +---------------------------------------------------------------------------------------------------------------------------+
199 5.3 Generated outputs from building soft-sensor-manager will be in "oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager".
201 5.4 To initiate THSensorApp, please enter as following;
203 +------------------------------------------------------------------------------------------+
204 |~/oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager$ ./THSensorApp |
205 |~/oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager$ ./THSensorApp1 |
206 +------------------------------------------------------------------------------------------+
208 5.5 To initiate SSMTesterApp, please enter as following;
210 +--------------------------------------------------------------------------------------------+
211 |~/oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager$ ./SSMTesterApp |
212 +--------------------------------------------------------------------------------------------+