Interworking IoT platform

IoT Server and middleware for Interoperability between Heterogeneous IoT Platform Devices

Server

Interworking

v2.4.0
January 24, 2019

sjkang@cclab.kw.ac.kr
Seongju Kang

BSD 3-Clause License

Copyright (c) 2017, IoTKETI All rights reserved Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Git Hub Project Link
Mobius2.4
nCube

 

Gub Hub Release Direct DownLoad Link
Direct Link Revision Release Date
Mobius2.4.zip v2.4.0 Dec. 2018
nCube.zip v2.4.0 Dec. 2018

 

Mobius Platfrom Functionalities

Mobius Platform works as the middle bridge to enable the communications and interactions between IoT devices and IoT applications as following:
①  The Mobius server accepts the uploaded data from authenticated IoT devices and stores the data into the MySQL DB;
②  The authenticated IoT applications can retrieve the data stored in Mobius server using Mobius open APIs for monitoring purpose;
③  The authenticated IoT applications are able to control remotely IoT devices that have already registered with Mobius server by sending control commands included in < contentInstance > resource. The Mobius server then executes control commands to the target devices

Mobius Platform Components

Mobius server consists of HTTP, CoAP, MQTT, WebSocket server and MySQL DBMS while IoT applications implement HTTP, CoAP and/or MQTT clients in order to communicate with Mobius server.

Mobius Platform S/W Architecture  

For protocol binding support, Mobius has MQTT broker, CoAP server, WebSocket server that is bound to HTTP server internally. For example, MQTT protocol binding is supported by implementing MQTT to HTTP proxy. CoAP and WebSocket are designed in the same way. Mainly it consists of requester and responder. The requester contains the DB access component. Every HTTP request is go through requester component, parser, actor and then create SQL query to data access (e.g. retrieval, discovery) with DB connector. When it gets access result, the responder creates the response in XML, JSON or CBOR serialization.

Additional Module (Interoperable IoT Platfoms)

①   Foobot
②   Nest
③   Lockitron
③   Belkin Wemo

Mobius Platform Source Code Directory   

Source File Role and Function
mobius.js This file initiates Mobius server and helps loading main Node JS files. It also contains configuration parameters for Mobius server such as defaultbodytype indicating the serialization, usecsetype indicating CSE type (either IN-CSE, MN-CSE or ASN-CSE), usecsebase indicating CSEBase name, usecseid indicating CSEID, usedbhost indicating the host address, and usedbpass indicating the password for MySQL etc. Users can modify those configuration parameters.
app.js This file acts as role of flow router and it is the main code running Mobius-YT server.

① It handles initial processing of received packets.

② It initiates HTTP server with ‘listening’ mode to wait for HTTP requests target to the Mobius HTTP server.

③ It handles the parsing of URL of packets and evaluate the correctness of the request body resulted of parsing. It then sends the request to resource.js to continue the processing if the request is valid one, otherwise throws exceptions.

This file also implements the server clustering algorithms to improve the performance of HTTP server.

mobius/foobot.js It communicates with the Foobot device and stores the atmospheric measurements as oneM2M resources at regular intervals.
mobius/nest.js It communicates with the Nest thermostat and executes target temperature, current temperature, and operation mode service.
mobius/lockitron.js Lockitron A module that communicates with smart door locks to find devices that exist in the network. You can open and close the door remotely and register the current state as oneM2M resource.
mobius/wemo.js It communicates with belkin’s wemo switch and searches for devices on the network. You can turn the wemo switch on and off remotely.
mobius/responder.js It is responsible for handling the response process. It receives processing results from app.js and resource.js modules and generates responses from the processing results following format requested by originator either XML or JSON serialization.
mobius/db_action.js This file contains parameters used to connect and access to the database and parameters for returning response results from the database.
mobius/sql_action.js This file contains functions to receive data and parameters required for a series of database operations and functions to call db_action.js module to return data from database.
mobius/sgn.js This module file is responsible for checking the existence of <subscription> child resource under the requested target resource. If it exists, the module checks the event type and retrieves the field value of attribute notificationUril. Then it generates and sends a notification message to the address indicated by field value of attribute notificationUril.
mobius/security.js This file contains functions to check the access privileges of originators for a requested resource when the resource applies with <accessControlPolicy> resource. The originator ID is abstracted from request header field of X-M2MOrigin. The process checks the access right of current originator ID to a target resource and responds with ACESS_DENIED error when the originator ID has no privileges to access to the resource.
mobius/fopt.js
mobius/ts_agent.js This file contains functions to manage <timeSeriesInstance> resource. It monitors the mssing data in the <timeSeriesInstance> resource and then stores the missing data.
pxymqtt.js This file contains functions implementing mqtt proxying function to handle mqtt protocol messages in http protocol manner as following procedures:
① It creates a oneM2M mqtt topic with configuration information of Mobius server and then subscribe to the topic to receive mqtt requests targeted to this topic later.
② Whenever receiving mqtt protocol messages, it generates and sends a http request wrapping mqtt request message to Mobius server and waits for http response from Mobius server. It then abstracts http response and generates a mqtt response message correspondingly.
③ It responds with mqtt protocol message.
mobius/acp.js It contains functions to parse accessControlPolicy request. The accessControlPolicy resource is used to manage the access control privileges to resources that apply with access control policy.
mobius/ae.js It contains functions to parse AE request.
mobius/cb.js It contains functions to parse CSEBase request. The CSEBase resource contains configuration information of Mobius server.
mobius/cin.js It contains functions to parse contentInstance request.
mobius/cnt.js It contains functions to parse container request.
mobius/csr.js It contains functions to parse remoteCSE request.
mobius/grp.js It contains functions to parse group request.
mobius/lcp.js It contains functions to parse locationPolicy request.
mobius/mms.js It contains functions to parse multimediaSession request.
mobius/mn.js It contains functions to parse MN-CSE resource request including implementation of registration function with IN-CSE. It is used to drive nCube:rosemary.
mobius/sd.js It contains functions to parse semanticDescriptor request.
mobius/sub.js It contains functions to parse subscription request.
mobius/ts.js It contains functions to parse timeSeries request.
mobius/tsi.js It contains functions to parse timeSeriesInstance request.

IoT Service Framework for Interworking between Heterogeneous IoT Platforms


Introduction

The purpose of this project is to provide M2M(Machine-to-Machine) communication service between heterogeneous IoT platforms. IoT service platform was developed based on Mobius and nCube. Mobius and nCube-Thyme are the open source IoT server platform based on the oneM2M standard (http://developers.iotocean.org/). Mobius provides common services functions (e.g. registration, data management, subscription/notification, security) as middleware to IoT applications of different service domains. nCube-Thyme consists of three versions: Node.js version, Java version and Android version.

Mobius Architecture

Mobius_architecture.jpg

Supported Protocol Bindings

  • HTTP
  • CoAP
  • MQTT
  • WebSocket

Installation

  • MySQL Server
    The MySQL is an open source RDB database so that it is free and ligth. And RDB is very suitable for storing tree data just like oneM2M resource stucture. Most of nCube-Rosemary will work in a restricted hardware environment and the MySQL can work in most of embeded devices.

  • Node.js
    Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world. Node.js is very powerful in service impelementation because it provide a rich and free web service API. So, we use it to make RESTful API base on the oneM2M standard.

  • Mosquitto
    Eclipse Mosquitto™ is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 3.1 and 3.1.1. MQTT provides a lightweight method of carrying out messaging using a publish/subscribe model. This makes it suitable for “Internet of Things” messaging such as with low power sensors or mobile devices such as phones, embedded computers or microcontrollers like the Arduino.

  • Mobius2.4
    Mobius source codes are written in javascript. Our Mobius provide interworking Lockitron, Nest, Foobot, SmartThings platforms and was developed based on OCEAN Mobius (http://developers.iotocean.org/archives/module/mobius).

nCube Architecture

nCube.jpg

Installation

  • Node.js
    Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world. Node.js is very powerful in service impelementation because it provide a rich and free web service API. So, we use it to make RESTful API base on the oneM2M standard.

  • nCube2.4
    nCube-Thyme for Node.js source codes are written in javascript. Our nCube provide API mapping (Philips Hue and Alljoyn platform’s APIs  <-> oneM2M RESTful API).

IoT Service Platform Architecture

system_architecture.jpg