# fix TC-320 for SDK. /etc/tizen-build.conf# Disable to run below line because this results in always failure, so it can be regarded as useless.#[ "${TZ_BUILD_WITH_EMULATOR}" == "1" ] && generic_desktop_applications_fix_userhome developer

출처 : https://developer.tizen.org/development/iot-preview/iot-apis

IoT APIs

The Tizen IoT API provides a common set of interfaces allowing you to build compelling IoT device applications which achieve native performance. The characteristics include:

Common set API, which means that the Tizen IoT API is based on the Tizen 4.0 common profile. The API supports the common set of mobile, wearable, and TV profiles and allows you to make IoT applications, such as network audio applications.

Available platform binaries, which allow you to efficiently create an IoT application. Tizen Common Headed binaries for Raspberry Pi 3 and ARTIK 530 have passed the API test verification, which means that you can create IoT applications with a productive quality.

In Preview 1, the Tizen IoT API releases only the native "C" API. Other convenient language types for the API are to be considered in the future.

The following table lists the IoT-specific Tizen platform API group.

Things SDK API

Developing "Things" which are market-ready (with cloud support) has been a challenge for most of the companies and individual developers. The SmartThings™ Things SDK API helps you to create new IoT devices easily. The version number of the first release is 0.9, which is the preview version.

API Usage

The following figure illustrates the SmartThings™ Things API life-cycle.

Figure: SmartThings™ Things API life-cycle

Initializing Stack and Callbacks

Once the device configuration JSON file is ready, you can specify the read-only and read-write paths in the st_things_set_configuration_prefix_path() function (optional), and specify the file in the st_things_initialize() function:

The key difference is the req_msg->resource_uri value passed in the callbacks to distinguish the 2 resources. Since the resource URI is unique in the device definition, each resource can be handled separately.

The following examples illustrate the get and set request handling callbacks for a single and multiple properties:

For a single property, you must extract the desired property from the request message and update the device property database locally. Once you have updated the device property, you must update the response representation about the updated property which is sent to the client:

The following table shows the IoTivity interfaces that specify how the device returns its response. These interfaces can be used by the IoTivity client (such as Samsung Connect) to retrieve information from the server (device).

Table: IoTivity interfaces for responses

Name

Interface

Description

Baseline

oic.if.baseline

Includes all information about the resource, including metadata and collection information. This is the default interface type.

Linked List

oic.if.ll

Includes only the collection information about the resource. This is the default interface type for /oic/res.

Batch

oic.if.b

Allows for the aggregation of interaction with all resources. Each resource is interacted with separately, but their responses are aggregated.

The following table lists other interface types that are related to permissions. These interfaces are relevant for retrieve and update requests.

Since each peripheral supports different interfaces and protocols, you must check from the peripheral's specifications whether a specific protocol is supported. Peripheral I/O APIs are categorized based on the protocol.

Figure: Peripherals connected to an IoT device

Supported Protocols

The following table lists the supported protocols for the Tizen IoT hardware targets.

Table: Protocols supported by the Tizen IoT hardware targets

Protocol

ARTIK 530

Raspberry Pi 3

GPIO

Yes

Yes

PWM

Yes

No

SPI

Yes

Yes

I2C

Yes

Yes

UART

Yes

Yes

The following figures illustrate the pinout information for the Tizen IoT hardware targets.

Figure: ARTIK 530 pinout

Figure: Raspberry Pi 3 pinout

Prerequisites

To use the Peripheral I/O API, the application has to request permission by adding the following platform privilege to the tizen-manifest.xml file:

GPIO

GPIO (General-Purpose Input/Output) is a programmable interface for reading the state of binary input peripherals, such as a switch, and controlling the state of binary output peripherals, such as a LED.

GPIO sets a direction for the data transfer. It can also detect an interrupt signaled by a level transition: either a falling edge (high to low) or a rising edge (low to high). To detect the interrupt signal you want, set the appropriate edge mode.

PWM

PWM (Pulse-Width Modulation) is a programmable interface that allows you to, for example, control motor speed or change light brightness.

Peripherals that support PWM are controlled by the current strength. To modulate the current, the voltage needs to be modulated. The voltage is proportional to the intensity of the current.

To modulate the voltage, you must set the duty cycle and polarity:

The period is a constant interval at which the pulse repeats.

The duty cycle is the constant time within 1 period in which a signal is active.

A "polarity high" signal starts high for the duration of the duty cycle and goes low for the remainder of the period. Conversely, a "polarity low" signal starts low for the duration of the duty cycle and goes high for the remainder of the period.

The pulse repeats if repetition has been enabled.

Figure: Duty cycle

For example, if the period is 10,000,000 nanoseconds and the polarity high duty cycle is 7,000,000 nanoseconds, the average voltage is at 70%.

SPI

SPI (Serial Peripheral Interface) is a programmable interface for transferring data quickly to peripherals that require high performance.

The SPI protocol is a serial communication method that controls the clock signal as master and other peripherals connected to SPI as slaves. This protocol is used by peripherals, such as heart-beat pulse sensors and graphic displays, that require fast data transfer.

Figure: SPI interface diagram

The SPI is a communication method between 1 master and multiple slave devices. In the above figure:

CLK (SCLK or SCK) is a simple synchronization signal and a communication clock.

The data flows from the master to the slave in the MOSI (Master Out Slave In) line, and from the slave to the master in the MISO (Master In Slave Out) line. Full duplex data communication is possible with 2 lines (MOSI and MISO).

CS (Chip Select) is a signal for selecting a slave device.

SPI supports half duplex read/write and full duplex transfer.

To use SPI, you must set the following:

SPI mode

Figure: SPI modes

Each of the 4 available SPI modes defines a specific combination of clock polarity (CPOL) and clock phase (CPHA).

Table: SPI modes

SPI mode

Polarity

(CPOL)

Phase

(CPHA)

Description

SPI MODE 0

0

0

CLK (Clock) is first low and data is sampled on the rising edge of each clock pulse.

SPI MODE 1

0

1

CLK is first low and data is sampled on the falling edge of each clock pulse.

SPI MODE 2

1

0

CLK is first high and data is sampled on the falling edge of each clock pulse.

SPI MODE 3

1

1

CLK is first high and data is sampled on the rising edge of each clock pulse.

Bit order

The bit order refers to the sequential order in which bytes are arranged into larger numerical values. MSB indicates that the most significant bit is transmitted first. LSB indicates that the least significant bit is transmitted first.

Bit per word

The bit per word refers to the number of bits to be transmitted at a time when data is exchanged with a connected slave. Normally, it is set to 8 bits per word.

Frequency

The frequency refers to the clock signal in Hz. Since the frequencies are different for each slave device, the applicable value must be checked from the peripheral's specification.

I²C

I2C (Inter-Integrated Circuit) is a programmable interface that allows you to communicate with I2C peripherals.

I2C is a synchronous serial interface that uses a clock signal to synchronize data transfers between master and slave device:

Master device generates the clock and initiates communication with slaves.

Slave device receives the clock and responds when addressed by the master.

Figure: I2C interface diagram

To allow the I2C master to connect to 128 I2C slave devices, an I2C slave device provides a 7-bit address. Since most slave addresses are determined by the manufacturer, refer to the specification to find the slave device address.

Using the I2C bus, the master controls signal lines called SCL (Shared CLock) and SDA (Shared DAta) to read or write data to or from the device. SCL is a clock line for communication synchronization, and SDA is a data line. The master outputs the clock for synchronization with the SCL, and the slave outputs or receives data through the SDA according to the clock output to the SCL.

If the SDA line is used alone, only half duplex communication is possible because data is sent only to 1 line.

UART

UART (Universal Asynchronous Receiver-Transmitter) is a programmable interface that allows you to communicate 1:1 with a UART peripheral.

Figure: UART interface diagram

UART is an interface for exchanging data with peripherals. It is an asynchronous method that transmits data without a clock line, and consists of only 2 data lines: transmit (Tx) and receive (Rx). UART performs 1:1 communication.

Indicates the start of the communication before sending data and holds it for a bit time length.

Data

Transmits 5 to 8 bits of data.

Parity bit

Generates and transmits a parity value for error verification, and determines a receiving side error. The following options are available: None, Even, and Odd parity. Selecting None removes this bit.

Stop bit

Indicates the termination of the communication and holds 1 or 2 bits.

Baud rate

Asynchronous transmission/receiving speeds must be matched to the peripheral. For this purpose, the number of signals transmitted per second can be synchronized with a peripheral. It is called the Baud.

If a device supports a 5-wire UART port, hardware flow control can be used to increase the reliability of the data transmission. Software flow control can also be used to increase reliability.

세션제목 : IoTivity: Cloud Native Architecture and the Internet of Open Source Things

The Internet of Things is the most recent buzzphrase, and like “Cloud” before it has only a vague definition. Different people will give you different answers if you ask them what either of them are. Yet one thing is for certain: the Internet of Things is based on open source software and open standards.

In 2014, two related entities were created to address IoT problems: IoTivity and the Open Interconnect Consortium. OIC is a standards group, an alliance of companies uniting to create the communications protocol to power all types of exchanges between devices, things, and the cloud; where IoTivity is an open source collaborative project hosted by the Linux Foundation, aimed at implementing those protocols.

This session will give an overview of what the various interpretations of the Internet of Things actually are, and the technologies behind them. It will talk about the IoTivity project, what it is trying to solve, and how it is going about that, including its governance structure and especially its unique relationship with the Open Interconnect Consortium. In the process, the audience will learn what challenges the new “Things” world poses, and will hopefully be inclined to contribute to the joint efforts that are trying to solve them.

There has been an increased support for various profiles and devices on Tizen. As Tizen is a multi/cross platform, device integration will be the main factor of a fluid interface between devices. Whether it is Mobile, Wearable, or TV the scalability and usability will be accessible. These features will allow the users to gain: (1) Easy Access, (2) Content Mash-up, and (3) Multi Device Control. This presentation will introduce the "Tizen Pass" which cover Cross device User Experience & features of Tizen convergence service FW