19
Embedded Software Lab. @ SKKU 19 1 Sungkyunkwan University Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service

15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

  • Upload
    others

  • View
    17

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

1

Sungkyunkwan University

Tizen/Artik IoT Lecture Chapter 15.IoTivity Notification Service

Page 2: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

2

• Notification Service– Revisit the Observe Usage in Simple Server– Scenario– Architecture

• Operations– Start or Stop Notification service– Discovery of Notification Resource– Subscription to Notification Resource– Sending Notify– Synchronization of Notification Message

• Sample

Contents

Page 3: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

3

• Observe Registration and notify

Revisit the Usage of OBSERVE in Simple Server

Create Light Value changed Watcher Thread

CheckObserverList

Send Notify

Entity Handler check observe message & push observer into observer list

1

2

3

4

Page 4: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

4

• It is possible to make notification service only with IoTivity Base API. However...– Notification service can utilize caching and monitoring features– Can configure the access policy– Topic-based Subscribe and Publish – Supports platform independent features– Prioritizes the notification– Makes fully use of IoTivity Cloud Server– etc..

Notification Service

Page 5: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

5

• D2D Notification - Consumer and Providers are in Local Area Network• D2S Notification - Consumer and Providers are connected via IoTivity

cloud

Notification Service Scenario

Page 6: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

6Notification Service Architecture

IoTivity Base

Service Components

Page 7: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

7Start or Stop Notification service

Page 8: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

8Start or Stop - Notification Provider

Callback Register

Network Monitoring Start

Consumer, Topic List Setup

Scheduler Methods Register

DiscoveryScheduler

SubscriptionScheduler

NotificationScheduler

TopicScheduler

Start Presence

Register Presence

Page 9: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

9Start or Stop - Notification Consumer

Callback Register

Network Monitoring Start

Discovery

Is provider presence

Yes

Page 10: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

10Discovery of Notification Resource

Publish Resource to Cloud

1. Access Policy2. Notification Resource URI3. Notification Message(Topic) URI4. Notification Sync URI

1. Access_all ( Accept all subscriptions )

2. Access_Check (Accept or Deny subscriptions)

Page 11: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

11

• Why the subscription message contains 3 distinct URI?

Resource Model

• Notification Message : GET (CRUDN)• Notification Sync : PUT (CRUDN)• Notification Topic : PUT (CRUDN)

Page 12: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

12Subscription to Notification Resource

If Access_all Policy, then notification subscription success

If Access_check Policy, server handle whether the consumer is subscribed

Observe !!!

Subscription Done

Page 13: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

13Sending Notify

1. Access Policy2. Notification Resource URI3. Notification Message URI4. Notification Sync URI

Page 14: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

14

• Sometimes consumer wants to read the resource synchronously

Synchronization of Notification Message

1. Access Policy2. Notification Resource URI3. Notification Message URI4. Notification Sync URI

Page 15: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

15Start & Discovery Code Sample

Access_check

Access_all

<provider>

<Consumer>

Page 16: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

16First Notify Message Sending

<provider>

1. Access Policy2. Notification Resource URI3. Notification Message(Topic) URI4. Notification Sync URINotify

<Consumer>1

2

3

4 Update Topic List and Subscription

Page 17: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

17IoTivity Cloud Connection - Provider

1

2

Request Access_Token to

Github Auth code

Auth Code String

Github send Access_Token to

Application

Using Access_Token the Application can

access the server

Page 18: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

18IoTivity Cloud Notification Service Register - Provider

1

<Resource Handle Register>

<Discovery Scheduler>

<Notification Resource Handler Register>

Page 19: 15-IoTivity Notification Service - Tizen Wiki...Tizen/Artik IoT Lecture Chapter 15. IoTivity Notification Service Embedded Software Lab. @ SKKU 19 2 • Notification Service –Revisit

Embedded Software Lab. @ SKKU

19

19IoTivity Cloud Notification Service Register - Consumer

Server Discover