This guide provides instructions and resources to help developers set up the development environment, build the IoTivity stack and build sample applications.
We offer IoTivity Services source code through Master branch, with the exception of Connectivity Abstraction and Control Manager. These two services are being tested and will be available through the Master branch in the future.
You can download the source code for Connectivity Abstraction and Control Manager using independent branches in the “iotivity” project on the git server.
Download the source code:
After you download the source code to your local folder, follow the steps to build and execute each service and it's applications. In this context, we assume that the code was downloaded into the “iotivity” folder.
After downloading, three main directories (resources, services, and utilities) are generated as follows:
~/iotivity/resource $_ ~/iotivity/service$_ ~/iotivity/utilities$_
Open the terminal window and follow these instructions to install all the necessary tools and libraries to build your IoTivity project:
Git is a source code management software. IoTivity is set as a git project. Git is mandatory to get access to the IoTivity source code. Use the following command to download and install git.
$ sudo apt-get install git-core
Secure Shell is required to connect to the GIT repository to check out the IoTivity source code. SSH is typically part of the base operating system and should be included. If for any reason it is not available, it can be installed by running the following command in your terminal window:
$ sudo apt-get install ssh
G++ is required to build the IoTivity stack. Download and install G++ by running the following command in your terminal window:
$ sudo apt-get install build-essential g++
Boost c++ library is required to build the IoTivity stack. Download and install boost libraries by running the following command in your terminal window:
$ sudo apt-get install libboost-all-dev
Doxygen is a documentation generation tool used to generate API documentation for the IoTivity project. Download and install Doxygen by running the following command in your terminal window:
$ sudo apt-get install doxygen
Gerrit is a web-based code review tool built on top of the git version control system. Gerrit's main features are side-by-side difference viewing and inline commenting, which streamline code review. Gerrit allows authorized contributors to submit changes to the git repository after reviews are done. Contributors can have code reviewed with little effort, and get their changes quickly through the system.
If you want to use SCons to build each service, build the source code and execute sample applications.
To build the API reference documentation:
resource/docsfolder using the terminal window.
cpp-docrun the following command:
These commands build the docs in the local working directory, not in the output directory used to store built binaries. So for example find the C SDK docs in:
After the source code is downloaded to your local folder, follow the steps to build and execute Soft Sensor Manager and its applications. In this context, we assume that the code was downloaded into the “iotivity” folder.
The path for Soft Sensor Manager is as follows:
The SoftSensorManager directory includes the following sub directories:
|/build||Makefiles for different platforms including Linux, Tizen, and Arduino.|
|/SampleApp|| There are two types of sample applications; application for UI, and application for physical sensors.
For UI application, there are SSMTesterApp in /linux, and /Tizen.
For physical sensors,
1) Temperature and Humidity sensors, THSensorApp, in \linux and \arduino.
In the two directories, in \linux and \arduino , there are two TemperaterHumiditySensor applications, THSensorApp and THSensorApp1, and they are for DiscomfortSoftSensor which aggregates two TemperaterHumiditySensors to calculate current discomfort index in the given room.
2) Trackee_Thing for IndoorTrajectorySensor in \arduino
|/SDK||The SDK APIs for applications.|
|/SSMCore||The SSM service codes.|
|/SoftSensorPlugin|| The source codes for soft sensors can be located in this folder.
Examples of soft sensors are DiscomfortIndexSensor and IndoorTrajectorySensor.
There are readme files in the build directories for each module (e.g. \SDK, \ SSMCore, \SampleApp). Please refer to the files for specific setup.
3.1: Run make for SoftSensorManager and App in Ubuntu.
3.1.1: Before running make for SoftSensorManager & App in Ubuntu, resource should be built in advance. Please refer to “Build the IoTivity project for Linux” in previous section.
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”. You can also find other packages in the folder.
3.2: Run make for App in Arduino
3.2.1: If you want to build for Arduino, download Arduino IDE (Arduino 1.0.6) from the following url. Extract “arduino-1.0.6-linux32.tgz” and change the folder name from “arduino-1.0.6” to “arduino” and then move to “/usr/share/”.
$ mv arduino-1.0.6 arduino $ sudo cp -Rdp ./arduino /usr/share/
3.2.2: Download Time library (Time.zip, Click “The download”) from the following url. Unzip Time.zip and move them to /usr/share/arduino/libraries.
$ sudo cp -Rdp ./Time /usr/share/arduino/libraries/
3.2.3: Create file named “local.properties” in “/iotivity/resource/csdk/” with the following definitions:
< local.properties > ARDUINO_DIR = /usr/share/arduino ARDUINO_TOOLS_DIR = $(ARDUINO_DIR)/hardware/tools/avr/bin
If you have a problem with compiling “resource” when you compile the arduino application, you may need to check 'local.properties' which is written in the readme file, '/iotivity/resource/csdk/README'.
3.2.4: Before running make for the application, first build the resource with arduino platform. Example:
~/iotivity/resource/csdk$ make PLATFORM=arduinomega ARDUINOWIFI=1
PLATFORM : arduinomega or arduinodue ARDUINOWIFI : 0 (Ethernet), 1(Wifi)
3.2.5: Now, you are ready to build a sample arduino application. To build all sample applications for arduino:
~/iotivity/service/soft-sensor-manager/ build/Arduino$ make PLATFORM=arduinomega ARDUINOWIFI=1
If you want to build each sample application separately, go to the build directory for the sample application. THSensor App example:
~/iotivity/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build$ make PLATFORM=arduinomega ARDUINOWIFI=1
3.2.6: To build and deploy the binary into the target hardware board, Aruino in this case, you need 'install' option. See the following example for THSensorApp;
~/iotivity/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build$ make install PLATFORM=arduinomega ARDUINOWIFI=1
Before “make install”, you need to check the file located at “/iotivity/service/soft-sensor-manager/SampleApp/arduino/THSensorApp/build/Makefile”. Line 26, ARDUINO_PORT is the serial port path, which has to be aligned on your system.
Run THSensorApp and SSMTesterApp to check how soft-sensor-manager is working.
4.1: To initiate THSensorApp:
~/iotivity/service/soft-sensor-manager/build/linux/release$ ./THSensorApp ~/iotivity/service/soft-sensor-manager/build/linux/release$ ./THSensorApp1
4.2: To initiate SSMTesterApp:
Note: the sequence of process initiations should be followed due to process dependencies.
Automake is a tool for automatically generating Makefile.in files compiliant with the GNU Coding Standards. This tool is used for compiling C-Pluff open source which is used in the Plugin Manager.
$ sudo apt-get install automake
GNU libtool is a generic library support script. This tool is used for compiling C-Pluff open source which is used in the Plugin Manager.
$ sudo apt-get install libtool
GNU `gettext' utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages. This tool is used for compiling C-Pluff open source which is used in the Plugin Manager.
$ sudo apt-get install gettext
Expat is a stream-oriented XML parser library. This library is used for compiling C-Pluff open source which is used in the Plugin Manager.
$ sudo apt-get install expat
After the source code is downloaded into a specific folder, iotivity in this context, follow these steps to build and execute the Protocol Plugin Manager:
Two directories for iotivity-resources; iotivity/resource and ioyivity/utilities
The path for Protocol Plugin is:
The Protocol Plug-in directory includes the following sub directories:
|/plugin-manager||Directory for Plug-in Manager|
|/plugins||Directory for Reference Plugins|
|/lib||Directory for Common Library|
|/sample-app||Directory for Iotivity Sample Application|
|/doc||Directory for Developers Document|
|/build||Directory for Building and Binary Release|
Before building Protocol-Plugin Manager, C-Pluff library should be compiled:
~/iotivity/service/protocol-plugin/lib/cpluff$ aclocal ~/iotivity/service/protocol-plugin/lib/cpluff$ autoconf ~/iotivity/service/protocol-plugin/lib/cpluff$ autoheader ~/iotivity/service/protocol-plugin/lib/cpluff$ automake ~/iotivity/service/protocol-plugin/lib/cpluff$ ./configure ~/iotivity/service/protocol-plugin/lib/cpluff$ make
By running make in the protocol-plugin path, protocol-plugin manager, all plugins and sample applications will be created.
After downloading the code, make sure that the downloaded code structure is as follows:
Four directories for oic; extlib, resource, service, and tools.
~/iotivity/extlib$_ ~/iotivity/resource$_ ~/iotivity/service$_ ~/iotivity/tools$_
The path for Things Manager is:
The things-manager directory includes the following sub directories:
|/sdk||The SDK APIs for applications is located. The main functionality of this SDK is to provide developer-friendly APIs of Things manager component to application developers.|
|/sampleapp||It is the sample application on Ubuntu. Basically, the input and output of application on Ubuntu are displayed in the console.|
|/build||Whole library files and binary files would be made in this folder|
This guide will help you se tup your development environment, build the Control Manager, Controllee and RESTframework components with IoTivity stack and sample applications. After you successfully build the stack, the Developer“s Guide for each of these components is a good reference for using the Control Manager Service.
This guide provides instructions on how to build the stack. Instructions provided in this guide are tested against Ubuntu 14.10, however, Ubuntu version 12.0.4 and above are supported.
The path for Control Manager is:
The control-manager directory includes the following sub directories:
|/controlmanager||Control Manager source code|
|/controllee||Controlee source code|
|/RESTframework||REST Framework source code|
|/opensource|| Open source components,
|/samples|| There are 3 different samples.
|/docs||Developer's Guide and Getting Started documents|
|/makefiles||Internal makefiles and build configuration files|
|/build_common||Platform specific Scons build configuration scripts|
|Makefile||Top level makefile to build all components|
|SConstruct||Scons based main build file|
To build, set the BOOST_PATH environment variable in Makefile.
# boost folder path. BOOST_PATH=/home/iotivity/Desktop/boost_1_56_0. . .
There is a README file in the top level control-manager folder.
Enter the following command to run the controllee-server:
Enter the following command to run the controller-client service:
Enter the following command to run the controller-client service:
After the sample starts running send any http request using 'cURL or Python scripts.
Note: 'REST-client' runs at port 3115.