tizen/artik iot lecture chapter 15. iotivity …...tizen/artik iot lecture chapter 15. iotivity...
TRANSCRIPT
Embedded Software Lab. @ SKKU
19
1
Sungkyunkwan University
Tizen/Artik IoT Lecture Chapter 15.IoTivity Notification Service
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
Embedded Software Lab. @ SKKU
19
3
• Observe Registration and notify
Revisit the Observe Usage 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
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
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
Embedded Software Lab. @ SKKU
19
6Notification Service Architecture
IoTivity Base
Service Components
Embedded Software Lab. @ SKKU
19
7Start or Stop Notification service
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
Embedded Software Lab. @ SKKU
19
9Start or Stop - Notification Consumer
Callback Register
Network Monitoring Start
Discovery
Is provider presence
Yes
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)
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)
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
Embedded Software Lab. @ SKKU
19
13Sending Notify
1. Access Policy2. Notification Resource URI3. Notification Message URI4. Notification Sync URI
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
Embedded Software Lab. @ SKKU
19
15Start & Discovery Code Sample
Access_check
Access_all
<provider>
<Consumer>
Embedded Software Lab. @ SKKU
19
16First Notify Message Sending
<provider>
1. Access Policy2. Notification Resource URI3. Notification Message(Topic) URI4. Notification Sync URI
Notify
<Consumer>1
2
3
4 Update Topic List and Subscription
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
Embedded Software Lab. @ SKKU
19
18IoTivity Cloud Notification Service Register - Provider
1
<Resource Handle Register>
<Discovery Scheduler>
<Notification Resource Handler Register>
Embedded Software Lab. @ SKKU
19
19IoTivity Cloud Notification Service Register - Consumer
Server Discover