Framework for IoT interoperability Philippe Coval Samsung Open Source Group / SRUK [email protected] From sensors to Tizen devices and beyond ? Open Source Innovation Spring #OSIS2017, CNRS Paris, France <2017-07-11>
/whois Philippe Coval • Software engineer for Samsung Research – Belongs to Open Source Group (S-OSG) EU/UK team • I am based in Rennes, France – Commits into IoTivity, Tizen, Yocto, Automotive OS (GENIVI, AGL)... – Ask me about FLOSS, OSHW, DIY, Communities • Find me online – https://wiki.tizen.org/wiki/User:Pcoval
Internet of Things is: A complex equation • Where all parameters are correlated : – Connectivity: not only Internet, probably IP, but not only • Personal (<1m), Local (<10m - 10km), Metropolitan (<10km), Wide Area (<1000Km) – Security matters ! (during all expected life span) • Several surfaces of attacks: service, monitoring, upgrade – Cost of materials and cost of usage: • Computing capability (CPU or MCU?), consumption, if 24x7 • Development, maintenance: FLOSS or Closed source ?
• Many Silos / Many implementations : – One app per device (better than many remote controls) – Dependence on centralized models (hub/cloud) • Many concerns or issues: – Security/Privacy concerns? – Long term support and maintenance? – Do we want critical devices exposed to the Internet ? • Few Interoperability/Interconnection of today's things. IoT: Internet of Today or Internet of Troubles ?
Open connectivity foundation's mission • Provide software linking the Internet Of Things – Focus on interoperability and seamless connectivity between devices • Write specification, Establish a protocol, – Rely on existing standards (CoAP, TLS), or OSS libs • Sponsor Reference implementation: – OpenSource (Apache 2.0 license) • Hosted by Linux Foundation (like kernel, Tizen etc) – Rule: No unimplemented features in specification • Certify conformance to standard of products • Above 300 members already joined, did you?
Flow: Create, Read, Update, Delete, Notify IoTivity Server IoTivity Client(s) Local IP Network Registration of resource Handling new requests Set/Get/ing properties values Initialization as server Initialization as client Handling new clients Discovery of resource POST/ GET UDP Multicast + CoAP Notify updated resource Observe resource change & Handling properties OBSERVE
IoTivity 1.2.1 is latest release – Uses Scons build system with many options: Transport, Security, Log... – Note: Upstream just enabled security on 1.3-rel Prefer to use or rebuild packages to local build/install – Use standard path (/usr/include …) Major Operating system are supported – Tizen provides RPM/spec for Tizen:3 profiles, with security enabled – Yocto's meta-oic ships it with security disabled like upstream – Debian, Ubuntu, deb packages are possible too • Details: https://wiki.iotivity.org/os , https://wiki.iotivity.org/build Samsung Open Source Group
application developers might not develop in upstream source tree – SCons build system is complex (even for sample apps) A standalone project is better to get inspiration from or derivate (SDK?) – Tend to be minimalist, can be used as base (fork it at will) Download a collection of standalone subprojects: – git clone http://git.s-osg.org/iotivity-example/ ; make Each ”feature” subproject is a git module (pulling a branch based on other) – Nice history to understand each steps – For many OSes or build system (Currently, GNUmake, Linux, Tizen, More welcome) Samsung Open Source Group
branch=example/master (src/example/master/README.md) – Server register a “dummy” resource identified as “/ExampleResURI” – Client discover and list all resources' endpoints served in local network – GNUmake is used to build it – Systemd service provided to start it once installed branch=example/packaging is based on previous one – Yocto Bitbake recipe – Tizen RPM spec file – Debian/Ubuntu packaging files too (more welcome) Samsung Open Source Group
IP Network Resource discovery example flow class IoTServer { int main() { init(); … } OC::PlatformConfig mPlatformConfig; void init() { mPlatformConfig = OC::PlatformConfig (OC::ServiceType::InProc, OC::ModeType::Server, // different that C "0.0.0.0", 0, // default for all subnets / ifaces OC::QualityOfService::LowQos //or HighQos ); OCPlatform::Configure(mPlatformConfig); } }; class IoTClient { int main() { init(); … } OC::PlatformConfig mPlatformConfig; void init() { mPlatformConfig = OC::PlatformConfig (OC::ServiceType::InProc, OC::ModeType::Client, // different than S "0.0.0.0", 0, // on any random port available OC::QualityOfService::LowQos // or HighQos ); OCPlatform::Configure(mPlatformConfig); } };
Binary switch example • Actuator, client change value (on/off) of server's resource • IoTivity-example's branch=switch/master – Is based on “example/packaging” and adapted • Usage: ./bin/client menu: 0) Set value off 1) Set value on (...) 1 ./bin/server -v log: { OCEntityHandlerResult IoTServer::handleEntity(...) log: { OCStackResult IoTServer::handlePost(...) log: { void Platform::setValue(bool) 1 log: } void Platform::setValue(bool) log: { void IoTServer::postResourceRepresentation()
Interaction with products • Tizen is an Operating System based on FLOSS • Shipped into consumer electronics products • Tizen IoTivity – Tizen:3 contains as platform package (.rpm) – Tizen:2 can ship shared lib into native app (.tpk) • For Samsung Z{1,2,3} (Tizen:2.4:Mobile) • Samsung GearS{2,3} (Tizen:2.3.x:Wearable)
app iotivity-example branches for Tizen devices: – Mobile (Z1) : switch/tizen/2.4/mobile/master – Wearables (GearS2) : sandbox/pcoval/tizen/wearable/2.3.2/master Need to rebuild IoTivity’s shared lib (to be bundled in tpk): – Use helper script build rpm and unpack lib – ./tizen.mk ; ls lib/*.so – ./tizen.mk run # deploy on root device (ie TM1) More details or ask for help: – https://wiki.iotivity.org/tizen Samsung Open Source Group
use case Various examples combined in demo using nodejs – Branch “sandbox/pcoval/on/master/demo” • Defective Street lights notification service – Sensor to read luminance – Switch front light on if too dark – Send message to ARTIK cloud – Using geolocation client/server Samsung Open Source Group 1 1 2 3 5 6 4 7
Summary • OCF establishes a standard for interconnecting things – Resource model – RESTful architecture – Definitions must be shared to ensure interoperability • Open Source project IoTivity – implements it in C, C++, Java and Javascript – Shipped into Tizen:3+ and available for many OS. – Provide core and hi level services for management, security, cloud