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 email@example.com would type:
$ ssh-keygen –t rsa –C “John Doe firstname.lastname@example.org”
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.
$ source gbsbuild.sh
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-x.x.x.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 directory 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||It contains the APIs that control the plugins i.e. start Plugin, stop Plugin etc.|
|plugins||It contains the plugins.The new plugins should be placed inside this folder|
|sample-app/tizen||It contains the sample application for Tizen.|
If you want to check how Protocol plugin works, 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.
if (mosquitto_connect(myMosquitto, "192.168.1.8", 1666, 60) != MOSQ_ERR_SUCCESS)
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 directory is as following:
The soft-sensor-manager directory includes following sub directories:
|Build||It contains whole library files and binary files.|
|SampleApp/tizen||It contains the SSM sample application. The application can be imported into tizen 2.3 SDK to build and to run.|
|SDK/cpp||It conatins the C++ SDK APIs for Soft Sensor Manager service.|
|SSMCore||It contains the SSM service codes.|
|SoftSensorPlugin|| It contains the source codes, for example: soft sensors.
Examples of soft sensors are DiscomfortIndexSensor and IndoorTrajectorySensor.
1. Sample application (SSMTesterApp) depends on other Linux applications for functionality testing , so build the iotivity project for Linux platform. (refer Readme.scons.txt available in iotivity home directory).
2. Run the Linux THSensorApp & Linux THSensorApp1 to test the SSM functionality.
Steps to run: - Export LD_LIBRARY_PATH to “<iotivity>/out/linux/<arch>/release”. - Run THSensorApp and THSensorApp1 application from the below path: <iotivity>/out/linux/<arch>/release/service/soft-sensor manager/ Note: '<iotivity>' is the path to 'iotivity' project.
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 contains the sample applications for Tizen.|
|Sdk||It contains the SDK APIs for applications. 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.
1. The sample applications (TMSampleApp, ConServerApp) depend on other Linux applications for functionality testing, so build iotivity project for Linux platform. (refer Readme.scons.txt available in iotivity home directory).
2. Con-server(Linux) and bootstrapserver(Linux) should be running in the same test environment for testing configuration features.
3. Lightserver(Linux) and bookmark(Linux) should be running in the same test environment to test group action features.
4. Sample application uses boost libraries which are available as a zipped folder under “iotivity/extlibs/boost”. Unzip it.
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 directory is as following: