Samsung Open Source Group 1
connected with
Open Source Innovation Spring 2016<2016-05-03>
Philippe CovalSamsung Open Source Group / SRUK
Samsung Open Source Group 2
Until 2020
Samsung Open Source Group 3
IoT ? You said ?
● “I” like Interoperability – Do we want all devices exposed to the Internet ?
– <blink>Local connectivity between devices</blink>
– Today, gateway is a reasonable answer
● “O” like Openness– Open standards, protocol, implementations
● “T” like Trustworthy– Security is Sine qua non condition for IoT
Samsung Open Source Group 4
“T” like platform
● Integrates many existing components :– Mainline Linux kernel with SMACK security module
– libc, X11/Wayland, GStreamer, EFL, WebKit/Blink
● Split into profiles for specific features– Mobile, Wearable, IVI...
● Shipped into consumer electronic products– 2011 … 2012 ... 2013 … 2014 … 2015 … 2016 ...
Samsung Open Source Group 5
“I” like framework
● Seamless device to device connectivity for IoT– Core: Discovery, Secure Transmission, Data/Device
– Plus profile services : SmartHome, Automotive, Health...
● C/C++ library (Apache 2.0) – RESTfull design : CoAP and CBOR
● Backed by Open Connectivity Foundation– Establishes standard, certification
– With Industry support (Samsung, Intel, Cisco, GE, +170)
Samsung Open Source Group 6
“O” like Openness
● Tizen and IoTivity are – FLOSS LinuxFoundation collaborative projects
● IoTivity / OCF– Not tied to Tizen or Linux or any vendor
● Cross platform : Linux, Yocto, Tizen, Android, MCUs, TBC
– Abstract Transport :● IP, Bluetooth, BLE, WiFi, +plugins (Zigbee, LTE, NFC)
– Backed by Open Connectivity Foundation● Open standard, with 170+ members
Samsung Open Source Group 7
Today's reality
● Tizen:3.0 platform supports IoTivity– Only on development devices (Single Board Computers)
● Some 2.x products are supporting Native APIs– On actual devices : Mobile and Wearables !
● IoTivity is also supported outside Tizen – Automotive: Poky based system (GENIVI, AGL, ...)
– Bridges, Web, Cloud : IoTivity node
● Open many developers opportunities !– Convergence
Samsung Open Source Group 8
Let's practice
Samsung Open Source Group 9
Challenge : IoT GPS Map
● Share a GPS position to nearby devices– https://youtu.be/Y7gwAlaoq5U#iotivity-gears2-20160427rzr
● Using IoTivity on Tizen powered devices– Make a basic server:
● shares a resource (pair of float numbers)● To run on supported device
– Make a basic client:● displays position on a map● To run on consumer product(s)
Samsung Open Source Group 10
Single Board Computer on Tizen 3
● RPI 0– 5 EUR
– Yocto
– GPIO
– GPU
– USB
– ARMv6
– No Eth
● RPI 2– ARMv7
– Ethernet
Samsung Open Source Group 11
Build an IoT server
● Invest 5 EUR into RaspberryPI zero● Learn a bit about Yocto (or ask me helper script)● And build a tizen-distro image
source ./tizen-common-init-build-env build-common
BBLAYERS += ".../meta-raspberrypi"
BBLAYERS += ".../meta-oic"
IMAGE_INSTALL += " iotivity "
● Add virtual GPS server recipe and rebuild image
Samsung Open Source Group 12
Build IoT clients 1/2 : library
● Setup and configure GBS for :– Tizen:2.4:Mobile for Z1
– Tizen:2.3.1:Wearable for Gear S2
– Tizen:3.0 for x86 or ARM
● Build dependencies 1st : (scons, boost...)– git clone $URL -b ${branch} # (ie: tizen, tizen_2.4)
– gbs build -p ${profile} # (ie: tizen_mobile-armv7l)
● In the end : iotivity-*.rpm
Samsung Open Source Group 13
Build IoT clients 2/2 : app
● Create Native EFL app (C/C++)– Using supported tizen-sdk
– For selected profile :● Tizen:2.4:Mobile for Z1 or Tizen:2.3.1:Wearable for Gear S2
● Integrate IoTivity library :– Unpack lib and headers from RPM in project
– Update Eclipse project settings (to link with IoTivity see wiki)
● Code your client using EFL (hint: elm_map)● Deploy package to Device (*.tpk)
Samsung Open Source Group 14
Client / Server Flow
2016-04-2714
OCPlatform::Configure(OC::PlatformConfig )OCPlatform::registerResource(...) ...
OC::EntityHandler(OCResourceRequest){ switch(getRequestType) { case 'GET' : ... OCPlatform::sendResponse(...);; case 'PUT' : ... OCPlatform::sendResponse(...); OCPlatform::notifyAllObservers();; }}
OCPlatform::findResource(...) // Multicast for discovery:(UDP)
OCPlatform::Configure(OC::PlatformConfig )
OC::OCResource::put(...) OC::PutCallback(...)
OC::OCResource::get(...) OC::GetCallback(...)
IoTivity Server(on Tizen 3)
IoTivity Client(s)(on Tizen 2)
OC:ObserveCallback(...)
IP Network
Samsung Open Source Group 15
Shared Resource
● Once setup server owns resource's value:– Updates it in a loop (from GPS or simulated)
● m_Representation.setValue("lat", m_lat);● m_Representation.setValue("lon", m_lon);
● Once discovered client reflects the resource:– Listen as observer (transparent)
– or polling on GET (using EFL timer)
– onChange(... const OCRepresentation &rep …)● lat = rep.getValue<double>("lat");● lon = rep.getValue<double>("lon");
Samsung Open Source Group 16
More Showcases
Samsung Open Source Group 17
More Showcases
● Real world resources : Relay control– Using GPIO (MinnowMax, GENIVI, OSVehicle)
● https://vimeo.com/164000646#tizen-genivi-20160424rzr
● Check Automotive WIP about Bridging RVI to OCF too
Samsung Open Source Group 18
Summary
● You can build your own full FLOSS IoT device – Running on and OS
– On accessible developer devices (SBC)
● Interact with commercialized products– Through Native apps
– Developed with Tizen SDK
– Linked with IoTivity
● Or any other devices of your dreams
Samsung Open Source Group 19
Reference
● Entry point :– https://wiki.iotivity.org/tizen
● Join online community (IRC) :– https://wiki.tizen.org/wiki/Meeting
● Resources :– https://github.com/tizenteam/iotivitymap
– https://blogs.s-osg.org/iotivity-ready-automotive/
– https://wiki.tizen.org/wiki/Raspberry_Pi
– http://www.slideshare.net/SamsungOSG/
Samsung Open Source Group 20
ThanksIRIL, INRIA, Pole Systematic, PF/OpenWide,
FLOSS Communities : Tizen, IoTivity, EFL, YoctoLinuxFoundation, OCF, SamsungOSG,
Libreoffice, FlatIcons (CC BY 2.0)YOU !
https://wiki.tizen.org/wiki/User:Pcoval