Skip to content

Latest commit

 

History

History
126 lines (107 loc) · 7.29 KB

HowToDevelopThingsWithTizenStudioForRT.md

File metadata and controls

126 lines (107 loc) · 7.29 KB

How to develop things with Tizen Studio for RT

Prerequisites

  • Java Development Kit (JDK)
    To install the appropriate JDK version for your Ubuntu system, go to the Ubuntu Web site and follow the detailed instructions for installing the Oracle® JDK version 8.
  • Package requirements for developing applications in Ubuntu
    You must install the webkitgtk package. At the terminal prompt, enter the following command:

    $ sudo apt-get install libwebkitgtk-1.0-0

1. Install the Tizen Studio for RT

To install the Tizen Studio for RT:

  1. Accept the software license.
  2. Configure the installation directory.
  3. Install the Tizen Studio for RT.
  4. Install additional tools.
  5. Run the Tizen Studio for RT.

More details can find at Guide page.

2. Create a Project

You can create a new SmartThings project from remote Git repositories as well as local templates. To create a new project:

  • When creating a project from a template, click the Check if you want Smart Things functionality check box when selecting a template:
    template - Check box
  • When importing a project from a Git repository, click the Check if you want Smart Things functionality check box:
    git - Check box

3. Manage Device/ Resource Model

You can use the Device/Resource Model Manager to select a device model for interworking with the SmartThings service.
With the Model Manager, you can:

The Model Manager is displayed while creating a new project with SmartThings functionality. If you want to access the Model Manager later again, in the Project Explorer view, right-click the project and select Manage ST-Things Resource.

Checking Device, Resource, and Property Information

To access information:

  • Select a device model in the Device Name list of the Device/Platform section to see device, platform, and resource information.
  • Select a resource in the left panel of the Resource/Property section to see the its description and property information.
  • Select a property in the right panel of the Resource/Property section to see its description.
    Viewing information
  • Input your MNID assigned by SmartThings website. Refer to here.
    Input a MNID

Managing Resources

You can select, add, and restore resources:

  • To select all resources, click the checkbox on the Resource/Property toolbar.
    Select all resources
  • To add a new resource:
    1. Click Add Resource.
      Add Resource
    2. In the Add Resource window, select the type of resource to be added, edit its information, and click OK.
      Add Resource
      The new resource appears in the list in the Resource/Property section of the Model Manager main view.
  • To restore the resources, click Restore default. This restores the initial resource state of the device, deleting all changes that have been made.

Importing and Exporting Device Models

To import a device model:

  1. Click Import on the Device/Platform toolbar.
    Import the JSON file
  2. Select the JSON file containing the device model to be imported and click OK.
    Select the JSON file
  3. The imported device shows up in the device list with the Custom type.
    The imported device shows up

To export a device model:

  1. Select the model to be exported and click Export on the Device/Platform toolbar.
    Export the model
  2. The device model is exported ad a JSON file. Enter a file name for the exported model and click OK.
    Exported as a JSON file

Generating Stub Code

When you click Finish in the Model Manager, the code for processing the resource is automatically created for the selected device.
Source code generated by the Model MAnager
Source code sample
When the project is created, template code for the selected device and resources is automatically generated and opened for editing:

<common_handlers.c>
- Reset, ownership transfer, and status change handlers
- You need to write additional code for the functionality you want.

<resource_<uri>.c>
- Get and set handlers for a resource
- You need to write additional code for the functionality you want.
- Refet to annotation or TODO in the resource file.

<Makefile> and <Make.defs>
- Makefile for building the project

<st_things_main.c>, <things.c>, <things.h>
- Project initialization, handler registration, and main loop

If you edit the SmartThings resources in your project later on, the Model Manager automatically backs the existing source files with a .bak extension.
Backup files

4. Build and Flash the Project

You must build your project before flashing or debugging it.
You can build a Tizen RT project in 2 ways: using a batch build or build project command.

Using Batch Build

To build your project using the batch build command:

  1. Select the project in the Project Explorer view.
  2. To build the selected project, use 1 of the following:
    In the Tizen Studio for RT menu, select Project > Batch Build Project.
    In the Tizen Studio for RT toolbar, click the Build TizenRT Project icon.
    Select 'Batch Build Project'
    Click the icon
  3. In the Build TizenRT Project Wizard, select the board - artik053 - and build option - st_things - for building your project, and click OK.
    Build option
    You can check the build logs in the Console view.
    Build logs

Using Build Project

To build your project using the build project command:

  1. In the Project Explorer view, select the project.
  2. In the Tizen Studio for RT toolbar, click the arrow next to the Build TizenRT Project icon and select Select Board.
    Select board
  3. In the Select Board and PreDefine Option window, select the board - artik053 - and build option - st_things - for building your project, and click OK.
    Build option
  4. In the Tizen Studio for RT toolbar, build the project by selecting Project > Build Project.
    Select 'Build project'
    You can check the build logs in the Console view.
    Build logs