This guide provides instructions and resources to help developers set up the development environment, build the IoTivity stack and build sample applications for Tizen. Developers should also read the IoTivity Programmer’s Guide before starting development to better understand IoTivity architecture and use cases.
The following tools and libraries are necessary to build the IoTivity code in Linux for Tizen platform. The commands and instructions provided in this section are specifically for Ubuntu LTS 12.04.
Open the terminal window and use the following instructions to install all the necessary tools and libraries to build an IoTivity project.
Ubuntu LTS version 12.04 is the supported OS for building the IoTivity stack. The instructions may be different for other versions of Ubuntu and Linux.
GBS (git-build-system) is a developer command line tool that supports Tizen package development. GBS is necessary to build the IoTivity code for Tizen platform. The following link contains information on how to install GBS.
Git is a source code management software. Git is necessary to gain access to the IoTivitiy 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. Secure Shell 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
SCons is a build tool used for compiling IoTivity source code. Please refer to the following link to install SCons:
Doxygen is a documentation generation tool used to generate API documentation for the IoTivity project. Download and install doxygen by running 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, streamlining 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.
The following five steps describe how to check out the source code on the development machine.
Note: skip Step 1 to use existing ssh keys.
On the terminal, type the following (replace “your name <your_email_address>” with your name and email address):
$ ssh-keygen –t rsa –C “your_name your_email_address”
For example John Doe with an email address firstname.lastname@example.org would type:
$ ssh-keygen –t rsa –C “John Doe email@example.com”
After pressing the Enter key at several prompts, an ssh key-pair will be created at ~/.ssh/id_rsa.pub.
1. Log in to IoTivity Gerrit.
2. Click on Settings on the top right side as shown here:
3. Click on SSH Public Keys and add key.
4. Open ~/.ssh/id_rsa.pub, copy the content, and paste the content in the “Add SSH Public Key” window.
5. Click Add.
1. Open ~/.ssh/config in a text editor.
2. Add the following lines:
Host iotivity gerrit.iotivity.org Hostname gerrit.iotivity.org IdentityFile ~/.ssh/id_rsa User <Insert_Your_Name_Here> Port 29418
3. To connect behind the proxy, add the following line after IdentityFile ~/.ssh/id_rsa with the appropriate proxy address and port:
ProxyCommand nc –X5 –x <proxy-address>:<port> %h %p
Execute the following command in the terminal window:
$ ssh gerrit.iotivity.org
Upon successful connection, the following message should appear indicating proper ssh and configuration connection.
∗∗∗∗ Welcome to Gerrit Code Review ∗∗∗∗
If the connection is not established, check for the proxy and use the proxy settings described in Step 3.
To build the IoTivity resource stack:
1. Using your terminal window, browse to the directory where code will be checked out.
2. Execute the following command in the terminal window to clone the oic-resource and oic-utilities repositories:
$ git clone iotivity:iotivity or $ git clone ssh://gerrit.iotivity.org/iotivity
This command clones the repository in your current working directory.
To run the applications of IoTivity services on Tizen targets, IoTivity stack should be built for Tizen platform. SCons tool is used to build for Tizen platform.
1. Build IoTivity base stack libraries and services libraries using this command. Run the below command in the top directory of IoTivity project.
$ scons TARGET_OS=tizen TARGET_ARCH=armeabi-v7a
2. After successful build, extract the required libraries from generated rpm (iotivity-x.x-x.armv7l.rpm) to run the applications of iotivity services.
Path for generated RPM: <home directory>/GBS-ROOT/local/repos/tizen/armv7l/RPMS/iotivity-0.9.1.armv7l.rpm
Once the IoTivity base stack and services are built for Tizen, you may follow the steps to build and execute the sample Protocol Plugin Tizen application. In this context, we assume that the code was cloned into ‘iotivity’ folder.
The path for Protocol Plugin Manager is as following;
The protocol-plugin directory includes following sub directories
|build||It contains the CMakeLists file for Tizen|
|lib||It contains cpluff library used by plugin Manager.|
|plugin-manager||Provides the APIs to control the plugins i.e. start Plugin, stop Plugin etc.|
|plugins||It is the folder where plugins are located. If we want to add any new plugin it should be located under this folder.|
|sample-app/tizen||It has the sample application for Tizen.|
If you want to check how Protocol plugin is working, you can run the Tizen sample application – PPMSampleApp.
In this sample application, you can start “mqtt-fan” plugin, find a fan resource and perform some operations with the fan resource. The sample application initially creates an instance of PluginManager and starts the “mqtt-fan” plugin by passing its resource type (“oic.fan”) to startPlugins() API of PluginManager. The startPlugins() API internally creates a resource server. Then the application finds the resource server using the findResource() base API of OCPlatform. Once the fan resource found, application will send put request to change the power of the fan resource (1 - on, 0 - off) repeatedly until we close the application.
1. Tizen SDK 2.3.
2. Sample application uses boost libraries. It should be located under iotivity/extlibs/boost folder.
Right click the PPMSampleApp → Run As → Tizen Native Application
Once the IoTivity base stack and services are built for Tizen, you may follow the steps to build and execute the sample Soft Sensor Manager Tizen application. In this context, we assume that the code was cloned into ‘iotivity’ folder.
The path for Soft Sensor Manager is as following;
The soft-sensor-manager directory includes following sub directories
|Build||Whole library files and binary files would be made in this folder|
|SampleApp/tizen||Contains the SSM sample application. The application can be imported into tizen 2.3 SDK to build and to run on tizen mobile device.|
|SDK/cpp||Provides the C++ SDK APIs for Soft Sensor Manager service.|
|SSMCore||The SSM service codes|
|SoftSensorPlugin|| The source codes for example soft sensors can be located in this folder.
Examples of soft sensors are DiscomfortIndexSensor and IndoorTrajectorySensor.
Built libraries are located in the folder
To run the Soft Sensor Manager sample App on tizen mobile device, the Base libraries and Soft Sensor Manager library are required as they have dependencies. The required libraries are:
1. Libcoap.so, Liboc.so, Liboc_logger.so, Liboctbstack.so
3. Soft Sensor Plugin with Soft Sensor description file
Follow the steps below to run the applications:
1. Import Soft Sensor Manager sample App into Tizen IDE.
2. Copy libraries of the Base and Soft Sensor Manager to sample app ‘lib’ folder.
3. Copy Soft Sensor Plugin with Soft Sensor description file to sample app ‘lib’ folder
4. Click ‘Run’ button to execute sample app
Once the IoTivity base stack and services are built for Tizen, you may follow the steps to build and execute the sample Things Manager Tizen application. In this context, we assume that the code was cloned into ‘iotivity’ folder.
The path for Things Manager is as following;
The things-manager directory includes following sub directories
|Build||It contains the build script files.|
|Sampleapp/tizen||It has the sample applications for Tizen.|
|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.|
If you want to check how things-manager is working, you can run the Tizen sample applications – TMSampleApp and ConServerApp.
Once the IoTivity base stack and services are built for Tizen, you may follow the steps to build and execute the sample Notification Manager Tizen application. In this context, we assume that the code was cloned into ‘iotivity’ folder.
The path for Notification Manager is as following;