+ All Categories
Home > Documents > 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU...

07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU...

Date post: 11-Apr-2020
Category:
Upload: others
View: 10 times
Download: 0 times
Share this document with a friend
22
Embedded Software Lab. @ SKKU 22 1 Sungkyunkwan University Tizen/Artik IoT Lecture Chapter 7. IoTivity Connectivity Abstraction
Transcript
Page 1: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

1

Sungkyunkwan University

Tizen/Artik IoT Lecture Chapter 7.IoTivity Connectivity Abstraction

Page 2: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

2

• Architecture• Routing Through Heterogeneous Connectivity• Blockwise Transfer• Call Path

– Sending Data– Receiving Data

• CA APIs

Contents

Page 3: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

3

• Message Switching– Gateway resource discovery – Routing table update and managing– Message routing( forwarding )

• CA Control Component– Target network selection and interface control and monitoring– CoAP message serialization and parsing– Blockwise messaging flow control

• Transport Adapter Component– Data transmission over UDP, TCP, BLE( GATT ), BT( SPP ) and NFC – Secure data exchanging using DTLS

• Platform Adapter Component– Ubuntu Wifi, Ethernet and BLE– Android Wifi, BLE and BT– Tizen Wifi, BLE and BT– Arduino Wifi, Ethernet and BLE

ArchitectureIoTivity v1.0

CA API

CA Control

NetworkConfig.

CoAPProtocol

InterfaceController

Transport Adapter

BLEAdapter

BTAdapter

Platform Adapter

Ubuntu Android Tizen Arduino

AndroidInterface

UbuntuInterface

TizenInterface

ArduinoInterface

TCPAdapter

IPAdapter

Resource Encapsulation

IoTivity Application

NFCAdapter

Message Switching

Routing Manager

Message Forwarder

Configuration

Resource Introspection

BlockwiseTransfer

Legend

CA Component CA Module External

Ubuntu Android Tizen Arduino

Page 4: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

4

• If any intermediary gateway device has multiple connectivity (ex. IP and BT), it can forward requests or responses so that resources on different transports can be discovered and communicated.

Routing Through Heterogeneous Connectivity

ROUTING=GW compile option

ROUTING=EP compile option

Page 5: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

5

• OIC client and OIC server can send/receive the large size messages by means of transferring of small block unit

Blockwise Transfer

Page 6: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

6Start from Basic API Example

Example: simpleClient.cpp...

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

“/oic/res” = all OIC devices that are discoverable

• OCPlatform::findResource (const std::string& hostconst std::string& resourceNameOCConnectivityType connectivityTypeFindCallback resourceHandler)

Page 7: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

7Call Path

OCPlatform

OCPlatform::findResource( host, resourceName, connectivityType, resourceHandler )

OCPlatform_impl

OCPlatform_impl::instance().findResource()

InProcClientWrapper

ListenForResource()

IClientWrapper

OCStack

OCDoResource()

OCSendRequest()

CaAPI

CASendRequest()

• OCPlatform à OCPlatform_impl àInProcClientWrapper à OCStack à CaAPI– Same as other Restful APIs’ call path; POST, GET, PUT, OBSERVE

Page 8: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

8

• iotivity/resource/csdk/connectivity/src• Routing manager source code is under the

iotivity/resource/csdk/routing

Source Code Hierarchy

IoTivity

Resource

src

ocplatform.cpp

csdk

ocplatform_impl.cpp stack/src

ocstack.c

Connectivity/src

caconnectivitymanager.c

camessagehandler.c

cacainterfacecontroller.c

Connectivity/src

canetworkconfigurator.c

caprotocolmessage.c

caqueueingthread.c

caretransmission.c

···ip_adapter

android

linux

arduino

tizen

Page 9: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

9Call Path: Sending Data1. Send requests are processed by Block-wise

transfer(BWT) basically in case of UDP and BT

2. BWT prepares atomic data with default size

(1KB) of block data and sends it to SendQueue

thread

3. SendQueueThread sends data to handler of

interested transport

4. ~ 6. In case of UDP, SendQueueThread for

UDP sends data to endpoint

2 Types of SendQueue: Common | Adapter

Page 10: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

10Call Path: Receiving Data1. In case of UDP, ReceiveThread for UDP

receives data from endpoint

2. In case that interested transport is UDP

or BT, BWT prepares next atomic data of

block data

3. It is sent to SendQueueThread again

4. If received data is the last data for block

in BWT, it is sent to ReceiveQueueThread

and finally sent to upper layer

Page 11: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

11CA APIsCAResult_tCAInitialize();void CATerminate();CAResult_tCAStartListeningServer();CAResult_tCAStopListeningServer();CAResult_tCAStartDiscoveryServer();voidCARegisterHandler(CARequestCallbackReqHandler,

CAResponseCallbackRespHandler,CAErrorCallbackErrorHandler);

CAResult_tCACreateEndpoint(CATransportFlags_tflags,CATransportAdapter_tadapter,constchar*addr,uint16_tport,CAEndpoint_t**object);

voidCADestroyEndpoint(CAEndpoint_t*object);CAResult_tCAGenerateToken(CAToken_t*token,uint8_ttokenLength);voidCADestroyToken(CAToken_ttoken);CAResult_tCASendRequest(constCAEndpoint_t*object,constCARequestInfo_t*requestInfo);CAResult_tCASendResponse(constCAEndpoint_t*object,constCAResponseInfo_t*responseInfo);CAResult_tCASelectNetwork(CATransportAdapter_tinterestedNetwork);CAResult_tCAUnSelectNetwork(CATransportAdapter_tnonInterestedNetwork);CAResult_tCAGetNetworkInformation(CAEndpoint_t**info,uint32_t*size);CAResult_tCAHandleRequestResponse();CAResult_tCASetRAInfo(constCARAInfo_t*caraInfo);

*inputparameter*outputparameter

Page 12: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

12

• CAInitialize()– Initialize the

connectivity abstraction module

– Initialize• adapters• common thread

pool• other modules

CA API – Initialize

Page 13: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

13

• CASelectNetwork()– Select network to

use

CA API – Select Network

Page 14: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

14

• CAStartDiscoveryServer()– Used by resource

required clients for listening multicast requests

– Based on the adapters configurations, different kinds of servers are started

CA API – Start Server

Page 15: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

15

• CACreateEndpoint()– Create an endpoint

description– Freed using

CADestroyEndpoint()

CA API – Create Endpoint

Page 16: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

16

• CAGenerateToken()– Generating the token

for matching the request and response

CA API – Generate Token

Page 17: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

17

• CASendRequest()– Send control request on a

resource• CA_GET/CA_POST/CA_PUT/CA_DELE

TE2. CADetachSendMessage() for

the interested transport(s)3. BWT if IP, NFC, DEFAULT

CASendThreadProcess() in common queue thread

4. CAGeneratePDU()5. Check block options6. CASendUnicastData()

Retransmission if IP/RFCOMM/GATT

7. CASendIPUnicastData()

CA API – Send Request/Response

Page 18: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

18

• Not through BWT

CA API – Send Request/Response if BLE, TCP

Page 19: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

19

• CAReceivePacketCallback()2. CAParsePDU()3. CAGenerateHandlerData()

Generate CA data to enqueue

4. Stop if ACK/RST message has been received

5. BWT6. Add CA data to queueing

thread• CAReceiveThreadProces

s()7. HandleCARequest() in

OCStack

CA API - Receive Request/Response

Page 20: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

20

• Not passing to upper layer, but just keep it in send queueing thread

CA API – Receive Request/Response

Page 21: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

21

• No BWT

CA API – Receive Response if BLE, TCP

Page 22: 07-IoTivity Connectivity Abstraction - Tizen Wiki · 2017-02-17 · Embedded Software Lab. @ SKKU 22 1 ... IoTivity Connectivity Abstraction. Embedded Software Lab. @ SKKU 22 2 ...

Embedded Software Lab. @ SKKU

22

22

• CAGetNetworkInformation()– Get network

information

CA API – Get Network Information


Recommended