26
OCF/IoTivity로 사물인터넷 개발하기 KCC 2017 Joo-Chul Lee ([email protected] )

OCF bridge 표준개발현황 소개 - WordPress.com · 2017-06-18 · Three Pillars – OCF Approach Specification - Defines OCF framework including standard model for IoT devices,

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

OCF/IoTivity로사물인터넷 개발하기

KCC 2017Joo-Chul Lee ([email protected])

Contents

OCF & IoTivity 개요- About OCF- About IoTivity

How to Build IoTivity Application- IoTivity Application Programming Procedure- Building IoTivity- Structure of IoTivity Application

OCF & IoTivity 개요• About OCF & IoTivity …

Why OCF?

Dilemma of current IoT world- Fragmentation, Fragmentation, Fragmentation !! (No universal language

for IoT)- Device maker

Limiting market, increasing costs- End users

Always check compatibility & interoperability

OCF’s mission- Bring “OCF products” to the market

Provides “Specifications”, “Codes”, “Certification program”- Make end users’ experience better

Seamless bridging to other ecosystems

OCF Members

Over 300 member companies…- Diamond members- Platinum members- Gold members- Nonprofit/academic members- Basic members

Three Pillars – OCF Approach

Specification- Defines OCF framework including standard model for IoT devices, apps, &

services to interact Stop fragmentation and increase device orchestration by creating a common

standard for IoT device connectivity

IoTivity Open Source- Delivers reference implementation of OCF framework & translation layers

for non-OCF devices Ease developers’ burden

Certification- Ensures interoperability via compliance and interop testing

Scope of OCF Framework

From OCF Overview, Matt Perry

OCF Resource

What is OCF resource?- In OCF world, entities are modeled as “Resource”- Entities :

Virtual object (e.g. data, logical state) Physical object (e.g. sensor, actuator)

How OCF resource is described?- Identifier: Resource Type (e.g. oic.r.temperature)- Properties: type, name, value - Resource is described in “json file”

How OCF resource is accessed?- Use URI: ocf://<authority>/<path> (e.g. ocf://192.168.1.1/room/light )

How to manipulate resource?- Use RESTful API (CRUDN: Create, Retrieve, Update, Delete, Notify)- Operations for resource is descried in “RAML file”

OCF Resource – schema example

oic.r.temperature.json

OCF Resource – RAML example

temperature.raml

OCF Resource – where can I find this info?

oneIoTa- OCF’s standardized data model repository- http://www.oneiota.org- “Schema in json” & “API in RAML” for OCF resource- E.g.) temperature

https://www.oneIoTa.org/documents?q=temperature Schema: https://www.oneIoTa.org/revisions/2358 API: https://www.oneIoTa.org/revisions/2190

File materials- https://github.com/OpenInterConnect/IoTDataModels

OCF application protocol

OCF adopted RESTful API- 2 Roles (Client, Server) & - 2 Messages (Request, Response) & - 5 operations (CRUDN)

OCF Client: A logical entity that accesses a Resource on a Server- Initiates a transaction (send a request)

OCF Server: A logical entity that exposes hosted Resources- Hosts resources- Sends response

CRUDN operation - Implemented over CoAP (The Constrained Application Protocol, RFC7252) by default- Delivered over UDP by default

Payload encoding- CBOR (Concise Binary Object Representation, RFC7049) is used by default

client server R

Putting all together

IoTivity

One of 3 pillars of OCF- Implement reference implementation of OCF specifications- Open source project hosted by Linux Foundation- Apache ver 2.0 license

Features- Resource / Endpoint Discovery (based on CoAP/Multicast)- Communication (RESTful API on CoAP) with Security (DTLS)- Supports various connectivity (Wifi, Eth, BT, BLE, NFC…)- Supports various OS (Linux, Android, Tizen, Windows…)- Supports various service (Mini Plugin Manager, Simulator, CoAP-HTTP

proxy…)

IoTivity information repository- https://wiki.iotivity.org

IoTivity Protocol Stack

Connectivity Layer

Resource Layer

Application Layer

Wifi, Ethernet, Bluetooth, zigbee, z-wave…TCP, UDP over IP

Session protection (DTLS)Session management (CoAP)

Core resourcesSecurity resources

Security Resource Manager (SRM)

Application specific resources

OCF Client OCF Server OCF bridge

How to Build IoTivity Application• IoTivity Application Programming Procedure

• Building IoTivity

• Structure of IoTivity Application

Procedure of IoTivity App Programming

Step 1. Identify required Things (devices)

Step 2. Find “OCF Resource Standard Model” for Things- http://www.oneiota.org

Step 3. Choose Platform & Connectivity Technology- Linux, Windows, Android …- Wifi, Ethernet …

Step 4. Coding main logic- Server- Client

Building IoTivity

Getting sources- Clone GIT repository from IoTivity directly

(https://www.iotivity.org/documentation/linux/getting-started)- Get from GitHub mirror (https://github.com/iotivity/iotivity)- Get tarball from IoTivity site (https://www.iotivity.org/downloads)

How to build IoTivity - https://wiki.iotivity.org/build_for_your_system

SCONS, build tool- A python-based software construction tool, easier than autoconf/automake- Get document (http://scons.org/documentation.html)- Get instant help

scons -h scons TARGET_OS=linux –h /* get context-aware help */ scons –c /* clean up */

- Example: scons TARGET_OS=linux TARGET_TRANSPORT=IP TARGET_ARCH=x86_64

LOGGING=true BUILD_SAMPLE=ON Generally, “scons <enter>” is ok

Building IoTivity (cont’d)

Where is Binaries?- /<IoTivity source folder>/out/<TARGET_OS>/<TARGET_ARCH>/release

E.g) /iotivity/out/linux/x86_64/release

Where is Samples?- /<IoTivity source folder>/out/<TARGET_OS>/<TARGET_ARCH>/release/

resource/examples- /<IoTivity source folder>/out/<TARGET_OS>/<TARGET_ARCH>/release/

resource/csdk/stack/samples

APIs for IoTivity application- C++ API (1)

For rich device (i.e. Linux) Examples: ./resource/examples

- C API (2) For constrained device (i.e. arduino) Examples: ./resource/csdk/stack/samples

Application

Structure of IoTivity Application –Initialization

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Structure of IoTivity Application –Registration of resource on server

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Structure of IoTivity Application –Resource Discovery (1)

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Structure of IoTivity Application –Resource Discovery (2)

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Structure of IoTivity Application –Discovering from client

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Structure of IoTivity Application –GET/POST using entity handler

From Prototyping IoT devices on GNU/Linux, Philippe Coval

Any questions?