Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / soft-sensor-manager / Readme.txt
1 /******************************************************************
2 *
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
4 *
5 *
6 *
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
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
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.
18 *
19 ******************************************************************/
20
21
22 ===============================================================================
23 ==                How to        Build SoftSensorManager                          ==
24 ===============================================================================
25
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.
29
30
31 =======================================
32 1. Download source code
33 =======================================
34
35 Once you download the codes, please make sure that the downloaded code structure is as follows; 
36
37 oic/resource 
38 oic/service
39 oic/utilities
40  
41  
42 The path for Soft Sensor Manager is as following;
43
44 oic/service/soft-sensor-manager
45  
46 The SoftSensorManager directory includes following sub directories;
47
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.
53                                                    For physical sensors, 
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
59  
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.
64
65
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.
72
73
74 =======================================
75 3. Run make
76 =======================================
77
78 3.1 Run make for SoftSensorManager & App in Ubuntu. 
79
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
82
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
85
86 +--------------------------------------------------------------+
87 | ~/oic/service/soft-sensor-manager/build/linux$ make          |
88 +--------------------------------------------------------------+
89
90 3.2 Run make for App in Arduino
91
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
95
96 +--------------------------------------------------------------------+
97 | $ mv arduino-1.0.6 arduino                                         |
98 | $ sudo cp -Rdp ./arduino /usr/share/                               |
99 +--------------------------------------------------------------------+
100   
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
104
105 +--------------------------------------------------------------------+
106 | $ sudo cp -Rdp ./Time /usr/share/arduino/libraries/                |
107 +--------------------------------------------------------------------+
108
109 3.2.3 Create file named ¡®local.properties¡¯ in  ¡°/oic/resource/csdk/¡± with the following definitions.
110
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'.
118
119 3.2.4 Before running make for application, you need to build resource with arduino platform first. 
120    Please refer to below example.
121
122 +------------------------------------------------------------------------------------------+
123 | ~/oic/resource/csdk$ make PLATFORM=arduinomega ARDUINOWIFI=1                             |
124 +------------------------------------------------------------------------------------------+
125    PLATFORM :  arduinomega or arduinodue.
126    ARDUINOWIFI : 0 (Ethernet), 1(Wifi)
127
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.
130
131 +------------------------------------------------------------------------------------------------+
132 |~/oic/service/soft-sensor-manager/ build/Arduino$ make PLATFORM=arduinomega ARDUINOWIFI=1       |                           
133 +------------------------------------------------------------------------------------------------+ 
134
135    If you want to build each sample application separately, go to build directory for sample application. 
136    Belowing is example for THSensor App. 
137    
138 +-------------------------------------------------------------------------------------------------------------------+
139 |~/oic/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build$ make PLATFORM=arduinomega ARDUINOWIFI=1     |                           
140 +-------------------------------------------------------------------------------------------------------------------+ 
141
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;
144
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.  
150
151
152 =======================================
153 4. Execute THSensorApp and SSMTesterApp
154 =======================================
155
156 If you want to check how soft-sensor-manager is working, you can run simple applications - THSensorApp and SSMTesterApp
157
158 4.1 To initiate THSensorApp, please enter as following; 
159
160 +------------------------------------------------------------------------+
161 |~/oic/service/soft-sensor-manager/build/linux/release$ ./THSensorApp    |           
162 |~/oic/service/soft-sensor-manager/build/linux/release$ ./THSensorApp1   |                 
163 +------------------------------------------------------------------------+
164  
165 4.2 To initiate SSMTesterApp, please enter as following;
166
167 +--------------------------------------------------------------------------+
168 |~/oic/service/soft-sensor-manager/build/linux/release$ ./SSMTesterApp     |
169 +--------------------------------------------------------------------------+
170
171 Note that the sequence of process initiations should be followed due to the process dependencies.
172
173
174 =======================================
175 5. Build with SCons
176 =======================================
177
178 If you want to use Scons to build soft-sensor-manager, build the source code and execute sample applications as following steps.
179
180 5.1 After downloading the source codes, type "scons" at project root directory "oic/"
181
182 +---------------------------------------+
183 |~/oic$ scons                           |
184 +---------------------------------------+
185
186 5.2 To execute Soft Sensor Manager and its applications, some shared libraries must be exported.
187
188 5.2.1 Go to "oic/out/<target_os>/<target_arch>/release", and check if there are following .so files
189  liboc.so
190  liboctbstack.so
191  liboc_logger.so
192  
193 5.2.2 To export the shared libraries, please enter as following;
194
195 +---------------------------------------------------------------------------------------------------------------------------+
196 |~/oic/out/<target_os>/<target_arch>/release$ export LD_LIBRARY_PATH=~/oic/out/<target_os>/<target_arch>/release            |
197 +---------------------------------------------------------------------------------------------------------------------------+
198
199 5.3 Generated outputs from building soft-sensor-manager will be in "oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager".
200
201 5.4 To initiate THSensorApp, please enter as following;
202
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 +------------------------------------------------------------------------------------------+
207
208 5.5 To initiate SSMTesterApp, please enter as following;
209
210 +--------------------------------------------------------------------------------------------+
211 |~/oic/out/<target_os>/<target_arch>/release/service/soft-sensor-manager$ ./SSMTesterApp     |
212 +--------------------------------------------------------------------------------------------+