User Tools

Site Tools


getting_started_iotivity_services_for_linux

Getting Started with IoTivity Services

This guide provides instructions and resources to help developers set up the development environment, build the IoTivity stack and build sample applications.

Cloning Git branch

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.

Source code download

Download the source code:

https://www.iotivity.org/downloads

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$_

Build tools and libraries

Open the terminal window and follow these instructions to install all the necessary tools and libraries to build your IoTivity project:

Git

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

ssh

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++

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 Version 1.55

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

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

Checking out the source code

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.

Build with SCons

If you want to use SCons to build each service, build the source code and execute sample applications.

Build the API reference documentation


To build the API reference documentation:

  1. Navigate to the resource/docs folder using the terminal window.
  2. In c-doc and cpp-doc run the following command:
$ doxygen
  1. To add the Java docs run the following command:
$ ./javadocGen.sh

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: resource/docs/c-doc/docs/html/index.html

SoftSensor Manager


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.

1. Source code structure

The path for Soft Sensor Manager is as follows:

~/iotivity/service/soft-sensor-manager$_

The SoftSensorManager directory includes the following sub directories:

Directories Description
/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.

2. Refer readme files in each build directory for each module.

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. Run make

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.

~/iotivity/service/soft-sensor-manager/build/linux$ make

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/”.

http://arduino.cc/en/Main/Software

$ 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.

http://playground.arduino.cc/Code/Time

$ 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.

4. Execute THSensorApp and SSMTesterApp

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:

~/iotivity/service/soft-sensor-manager/build/linux/release$ ./SSMTesterApp

Note: the sequence of process initiations should be followed due to process dependencies.

Protocol Plugin


Additional Libraries for Protocol Plugin:

Automake

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

Libtool

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

gettext

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

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

Building

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:

1. Source code structure

Two directories for iotivity-resources; iotivity/resource and ioyivity/utilities

~/iotivity/resource$_
~/iotivity/utilities$_

The path for Protocol Plugin is:

~/iotivity/service/protocol-plugin $_

The Protocol Plug-in directory includes the following sub directories:

Directories Description
/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

2. Compiling C-Pluff library

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

3. Run make

By running make in the protocol-plugin path, protocol-plugin manager, all plugins and sample applications will be created.

~/iotivity/service/protocol-plugin/build/linux$make

Things Manager


1. Source code structure

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:

~/iotivity/service/things-manager/$_

The things-manager directory includes the following sub directories:

Directories Description
/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

2. Build

~/iotivity/service/things-manager/build/linux$ make

Control Manager


Building Control Manager, Controllee, RESTFramework and sample applications in Ubuntu

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.

Building Control Manager and its samples

1. Source code structure

The path for Control Manager is:

~/iotivity/service/control-manager$_

The control-manager directory includes the following sub directories:

Directories Description
/controlmanager Control Manager source code
/controllee Controlee source code
/RESTframework REST Framework source code
/opensource Open source components,

1. Jsoncpp
2. Sqlite3
/samples There are 3 different samples.

1. controller-client
2. controllee-server
3. REST-client
/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
README.txt README file

2. Modify the BOOST path in the Makefile

To build, set the BOOST_PATH environment variable in Makefile.

# boost folder path.
BOOST_PATH=/home/iotivity/Desktop/boost_1_56_0.
.
.

3. Refer to the README file

There is a README file in the top level control-manager folder.

4. Run make

~/iotivity/service/control-manager$ make

5. Execute controllee-server, controller-client and REST-client

Enter the following command to run the controllee-server:

~/iotivity/service/control-manager/samples/controllee-server/{release/debug}$./controllee-server

Enter the following command to run the controller-client service:

~/iotivtiy/service/control-manager/samples/controllee-server/{release/debug}$./controller-client

Enter the following command to run the controller-client service:

~/iotivity/service/control-manager/samples/REST-client/{release/debug}$./REST-client

After the sample starts running send any http request using 'cURL or Python scripts.

Note: 'REST-client' runs at port 3115.

getting_started_iotivity_services_for_linux.txt · Last modified: 2018/01/12 16:37 by Mats Wichmann