Top Banner
Embedded Software Lab. @ SKKU 8 1 Sungkyunkwan University Tizen/Artik IoT Lecture Chapter 6. OCF Resource Type & IoTivity Simulator
8

Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

May 22, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

1

Sungkyunkwan University

Tizen/Artik IoT Lecture Chapter 6.OCF Resource Type & IoTivity Simulator

Page 2: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

2

• RAML makes it easy to manage the whole API lifecycle from design to sharing– http://raml.org

• Machine readable API design that is human friendly

• Support several languages– node.js, Java, .NET, Python

• The RAML definition are used to describe the payloads of the CRUDN operations– Used in simulation– Validating of responses

RESTful API Modeling Language (RAML)

Page 3: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

3

• A resource can be created or updated depending on the resource type’s definition and allowed CRUDN operations

• The operation may have different response code with different meaning

CRUDN Operation Response Codes

Response Code Meaning

200 Payload of the response will confirm the change

201 Payload is the URL of the Resource that was created by the server as a result of a CREATE operation

204 OK, everything went well, no payload provided

403 CASE1: On RETRIEVE, the server does not support the values providedCASE2: the server could not CREATE or UPDATE the Resource due to a problem with the provided payload

Page 4: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

4

• There are many resource types defined by OIC– 62 resource types are defined

• RAML and JSON set– Acceleration.raml– oic.r.sensor.acceleration.json

OIC defined Resource Types

Page 5: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

5

• URI: /AccelerationResURI• Rt: oic.r.sensor.acceleration

Example: Acceleration

JSON definition: oic.r.sensor.acceleration.json

RAML definition: Acceleration.raml

Page 6: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

6

• IoTivity Simulator provides two functions– Service provider– Client controller

IoTivity Simulator: Service Provider

Two ways to create resource

Failed to create resource with raml

Create resource manually

Test Automation

Page 7: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

7

• Find resource at the client side• You can use CRUDN operations

– GET, PUT, POST, OBSERVE, AUTOMATION

IoTivity Simulator: Client Controller

Page 8: Tizen/Artik IoT LectureChapter 6. OCF Resource Type & IoTivitySimulator · 2017-02-17 · Embedded Software Lab. @ SKKU 8 3 • A resource can be created or updated depending on the

Embedded Software Lab. @ SKKU

8

8

• During OBSERVE, provider can notify to client

IoTivity Simulator: Observe