08-Iotivity P2P Connection

08-Iotivity P2P Connection

1 22 Tizen/Artik IoT Lecture Chapter 8. IoTivity P2P Connection Sungkyunkwan University Embedded Software Lab. @ SKKU Contents 2 22 • IoTivity API Set • Discovery Subsystem – Registering & Discovering a Resource • Querying Resource State – GET – PUT – POST • Resource Observe • SimpLeCLient & SimpLeServer Embedded Software Lab. @ SKKU IoTivity API Set 3 22 • IoTivity supports various API set for platforms and Languages – Tizen, iOS, Android, Ubuntu, OS X, Windows (C/C++, Java, JS etc..) – There are two kinds of API stack : Rich-device and Constrained Devices Embedded Software Lab. @ SKKU Discovery Subsystem 4 22 Embedded Software Lab. @ SKKU Registering and Discovering a Resource (1/3) 5 22 • Resource Registration and Resource Finding are main functionalities in IoTivity Base Layer 1 2 registerResource(…); 3 RPC Call OCCreateResource(); (1). Server: Registering Resource (2). Client : Find Resource in IP Network (multicast) (3). Client : When the client find resource, the callback function is invoked 1 2 3 Embedded Software Lab. @ SKKU Registering and Discovering a Resource (2/3) 6 22 • Registering a resource API <Example> Embedded Software Lab. @ SKKU Registering and Discovering a Resource (3/3) 7 22 • OCPLatform::findResource (const std::string& host const std::string& resourceName OCConnectivityType connectivityType FindCalLback resourceHandLer) Example: simpleClient.cpp ... “/oic/res” = all OIC devices that are discoverable requestURI << OC_RSRVD_WELL_KNOWN_URI; OCPlatform::findResource(“”, requestURI.str(), CT_DEFAULT, &foundResource); ... à API for Service and Resource discovery (client side only) host == null: multicast resource discovery query Embedded Software Lab. @ SKKU Querying Resource State 8 22 • After registering and discovering states, the cLients can invoke GET, PUT query Embedded Software Lab. @ SKKU Querying Resource State: GET (1/2) 9 22 Embedded Software Lab. @ SKKU Querying Resource State: GET (2/2) 10 22 1 Query Response Unmarshaling 2 <Server> Unmarshaling <Client> Embedded Software Lab. @ SKKU Querying Resource State: PUT (1/2) 11 22 Embedded Software Lab. @ SKKU Querying Resource State: PUT (2/2) 12 22 Query unpacking Key:Value Packing Put <Client> Resource Set <Server> Embedded Software Lab. @ SKKU Querying Resource State: POST (1/2) 13 22 • POST can create new resource Like PUT Attribute setting 2 7 Create New Resource 1 Post Invocation 3 <Client> Send Response <Server> Embedded Software Lab. @ SKKU Querying Resource State: POST (2/2) 14 22 Check Resource Created 4 8 5 Attribute Check 9 6 <Client> New Attribute Setting Embedded Software Lab. @ SKKU Resource Observe (1/5) 15 22 • Observe happens at resource LeveL and operates in server/client model Embedded Software Lab. @ SKKU Resource Observe (2/5): Sequence FLow 16 22 Embedded Software Lab. @ SKKU Resource Observe (3/5): Sequence FLow 17 22 Embedded Software Lab. @ SKKU Resource Observe (4/5): SimpLeCLient 18 22 • Observe API 2 1 <Client> Embedded Software Lab. @ SKKU Resource Observe (5/5): SimpLeServer 19 22 • Observe Registration and notify 1 2 Entity Handler check observe message & push observer into observer list CheckObserverList 3 4 Create Light Value changed Watcher Thread Send Notify Embedded Software Lab. @ SKKU SimpleCLient (Android) 20 22 • IoTivity provides SimpleServer and SimpleClient examples for C/C++ and Andorid – SimpleClient and SimpleServer includes restful APIs such as get, put, post and observe Platfrom Config Register Resource Platfrom Config 2 1 Find Resource <SimpleClient> <SimpleServer> Embedded Software Lab. @ SKKU SimpleServer - Android 21 22 Observer List Addition Observing Thread Creation Request Handler HandleEntity Implementation Get Resoponse <SimpleServer> Embedded Software Lab. @ SKKU Android Simple Client & Server Test 22 22 • Using BLuetooth (RFCOMM over BLuetooth) Embedded Software Lab. @ SKKU.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    22 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us