User Tools

Site Tools


getting_started_iotivity_services_for_tizen_0_9_1_modify

IoTivity Services: Getting Started for Tizen

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.

Tools and Libraries

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 12.04

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

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.
https://developer.tizen.org/dev-guide/2.2.0/org.tizen.platform.development/html/platform_dev_env/gbs_installation.htm

Git

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

SSH

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

SCons is a build tool used for compiling IoTivity source code. Please refer to the following link to install SCons:
http://www.scons.org/doc/production/HTML/scons-user.html#chap-build-install

Doxygen

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

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

Step 1: Create 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 john.doe@example.com would type:

  $ ssh-keygen –t rsa –C “John Doe john.doe@example.com”

After pressing the Enter key at several prompts, an ssh key-pair will be created at ~/.ssh/id_rsa.pub.

Step 2: Upload and register an ssh public key

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.

Step 3: Setting up ssh

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

Step 4: Verify your ssh connection

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.

Step 5: Cloning the project source

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.

Build IoTivity Project for Tizen Platform with SCons

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

Build and Run Protocol Plugin Manager Sample Application

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;

  iotivity/service/protocol-plugin/

The protocol-plugin directory includes following sub directories

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

Protocol Plugin Manager Sample Application

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.

Pre-requisites

1. Tizen SDK 2.3.

2. Sample application uses boost libraries. It should be located under iotivity/extlibs/boost folder.

Build procedure

  1. Import PPMSampleApp to Tizen IDE.
    Follow the below steps for importing the sample application.
    1. File Menu→ Import → Tizen → Tizen Native Projects
    2. Enter path for importing
      “iotivity/service/protocol-plugin/sample-app/tizen”

  2. Create a lib folder in PPMSampleApp (if not exists) and copy the below mentioned libraries extracted from the iotivity RPM.
    • liboc.so
    • liboctbstack.so
    • libcoap.so
    • liboc_logger.so
    • liboc_logger_core.so
    • libpmimpl.so
    • libppm.a

  3. Also, copy:
    • libboost_system.so and libboost_thread.so from <home directory>/GBS- ROOT/local/BUILD-ROOTS/scratch.armv7l.0/usr/lib to “lib” folder of the project
    • fanserver_mqtt_plugin.so (from extracted RPM) to “/lib/plugins/mqtt-fan/” folder of the project

  4. Include path to boost header files and libraries as mentioned below
    Right click the project in IDE → Properties → expand C/C++ Build → Settings → Tool Settings → select includes option under C++ Compiler → add the path of the unzipped boost libraries in the include paths area → Apply → OK.

  5. Build PPMSampleApp projects.

Run sample application

Right click the PPMSampleApp → Run As → Tizen Native Application

Build and Run Soft Sensor Manager Sample 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;

  iotivity/service/soft-sensor-manager/

The soft-sensor-manager directory includes following sub directories

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

  Iotivity/out/tizen/{TARGET_ARCH}/release

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
2. libSSMCore.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

Build and Run Things Manager Sample Application

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;

  iotivity/service/things-manager/

The things-manager directory includes following sub directories

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

Pre-requisites

  1. Con-server and bootstrapserver(Linux) should be running in the same test environment for testing configuration features.
  2. Lightserver(Linux) and bookmark(Linux) should be running in the same test environment to test group action features.
  3. As the sample applications (TMSampleApp, ConServerApp) depend on other Linux applications for functionality testing as mentioned above, build iotivity project for Linux platform. (refer Readme.scons.txt available in iotivity home directory).
  4. Sample application uses boost libraries which are available as a zipped folder under “iotivity/extlibs/boost”. Unzip it.

Build procedure

  1. Import TMSampleApp and ConServerApp to Tizen IDE. Follow the below steps for importing the sample applications.
    1. File Menu→ Import → Tizen → Tizen Native Projects
    2. Enter path for importing:
      “iotivity\service\things-manager\sampleapp\tizen”

  2. Create a lib folder in TMSampleApp and ConServerApp projects (if not exists) and copy the below mentioned libraries extracted from the iotivity RPM.
    • liboc.so
    • liboctbstack.so
    • libcoap.so
    • liboc_logger.so
    • liboc_logger_core.so
    • libTGMSDKLibrary.so

  3. Include path to boost header files and libraries as mentioned below for both TMSampleApp and ConServerApp projects (Unzip the boost libraries if not done already)
    Right click the project in IDE → Properties → expand C/C++ Build → Settings → Tool Settings → select includes option under C++ Compiler → add the path of the unzipped boost libraries in the include paths area → Apply → OK

  4. Build TMSampleApp and ConServerApp projects and launch the applications on Tizen 2.3 device.

Run the projects

  1. Launch TMSampleApp and ConServerApp projects on Tizen devices.

  2. To test GroupAction features
    1. Run Lightserver(Linux) and bookmark(Linux) on linux machine.
      Follow the below steps to run the lightserver and bookmark
      • export LD_LIBRARY_PATH to <iotivity>/out/linux/<arch>/release
      • Navigate to the below path:
        “iotivity/out/linux/{arch}/release/service/things-manager/sampleapp/linux/groupaction”
      • To run lightserver, execute the command: “./lightserver”
      • To run bookmark, execute the command “./bookmark”
    2. Using TMSampleApp, group action features can be tested.

  3. To test Configuration features
    1. Run bootstrapserver(Linux) on linux machine
      Follow the below steps to run the bootstrapserver
      • export LD_LIBRARY_PATH to iotivity/out/linux/{arch}/release
      • Navigate to the below path:
        “iotivity/out/linux/{arch}/release/service/things-manager/sampleapp/linux/configuration”
      • To run lightserver, execute the command: “./bootstrapserver”
    2. Using ConServerApp, configuration features can be tested.

Build and Run Notification Manager Sample Application

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;

  iotivity/service/notification-manager/

Pre-requisites

  1. sampleprovider and sampleconsumer(Linux) should be running in the same test environment for testing configuration features.
  2. As sample application (NMSampleApp) depends on other Linux applications for functionality testing as mentioned above, build iotivity project for Linux platform. (refer Readme.scons.txt available in iotivity home directory).
  3. Sample application uses boost libraries which are available as a zipped folder under “iotivity/extlibs/boost”. Unzip it.

Build and Run procedure

  1. Import NMSampleApp from “service/notification-manager/SampleApp/tizen”

  2. Build base libraries and Notification Manager libraries using “sh gbsbuild.sh” in iotivity directory.

  3. Extract the required libraries from the generated rpm (iotivity-0.9.0.armv7l.rpm) to the “lib” folder of NMSampleApp project. Required libraries are
    • liboc.so
    • liboctbstack.so
    • libconnectivity_abstraction.so
    • libcoap.so
    • liboc_logger.so
    • liboc_logger_core.so
    • libNOTISDKLibrary.so

  4. Specifiy the path of the unzipped boost libraries in NMSampleApp project in the way given below:
    right click the project in IDE → Properties → expand C/C++ Build → Settings → Tool Settings → select includes option under C++ Compiler → add the path of the unzipped boost libraries in the include paths area → Apply → OK

  5. Build NMSampleApp project and launch the application in Tizen 2.3 device
getting_started_iotivity_services_for_tizen_0_9_1_modify.txt · Last modified: 2016/02/15 17:28 by Phil Coval