MediaSense

Features Overview

MediaSense is an Internet-of-Things platform for seamless, scalable data sharing, which works for peer-to-peer communication via a heterogeneous network overlay and is released under GNU Public General Licence Version_3. You can download the tutorial, and you can find the sample code in the tutorial. MediaSense is equipped with the following functionalities:

(1) Avoid Central Failure Point

The central point is the vital weakness for distributed communication. Any problem in the central point may cause the whole platform to crash, especially for data-intensive systems. MediaSense fixes this problem with its fully distributed peer-to-peer architecture without any central point.

(2) Scalable for Sensor Data Sharing

With the number of sensors used in systems on the rise, your system needs to be capable of accommodating more and more sensors and nodes. MediaSense provides a convenient approach to register and include new sensors and nodes using its distributed context exchange protocol (DCXP).

(3) Bi-directional Communication

As a peer-to-peer communication platform, MediaSense supports data sharing and communication between each data sink in IoT, regardless whether the nodes and data sink are of a different nature. This bi-directional communication functionality allows the caregiver to remotely trigger the actuators in the house and seamlessly collect sensor data.

Mechanism of MediaSense

The working mechanism of MediaSense can help users understand the source code during implementation. In its current version, MediaSense is implemented on the RaspberryPi, and each RaspberryPi acts as a node in the peer-to-peer network. Sensors are attached to the RaspberryPi (host), which has its own Universal Context ID (UCI) for communication. The MediaSense API is written in Java, which can run on any platform with the Java Environment.

(1) Universal context ID

In MediaSense, each context source will be allocated a Universal Context ID (UCI), which enables the sensors to communicate without knowing the IP address. Instead, they just need to know the UCI of the sensors they need to talk to. MediaSense can resolve the UCIs and provide the IP addresses of the hosts to which the sensors are attached to initiate data sharing.

(2) Distributed Hash table

MediaSense forms distributed context storage based on a distributed hash table (DHT), where the UCI will be stored. MediaSense is built on the overlay of Tomp2p which is an advanced implementation of DHT. With a hash function, the UCI is mapped to a closed space cycle. This space is segmented by the hosts (RaspberryPi) in a cycle to minimize changes to the platform resulting from adding and deleting nodes.

(3) Distributed Context Exchange Protocol

MediaSense adheres to the distributed context exchange protocol (DCXP) for sensor data sharing and exchanging. This DCXP process is carried out in the space cycle provided by DHT.

Register: Each new sensor added to MediaSense registers its UCI using class register.java.

Resolve: In order to locate the sensor data source, MediaSense needs to resolve the UCI needed by the sensor to communicate using resolver.java. The IP address is one of the results returned following resolving.

Get: After resolving, MediaSense uses getter.java class to retrieve the resource located in the sensors.

(3) The Packages of MediaSense

mediasense-strcuture

Mediasense Infrastructure

Figure 1. Mediasense Infrastructure

There are seven main packages in MediaSense, as shown in figure 1. The top layer is the interface which gets services from other layers under it. The distribution layer is where the Tomp2p overlay can be connected.

Interface Layer: The interface layer is the entry point to interact with the MediaSense platform. This layer provides all the necessary actions to interact with the other layers of the platform. This layer employs the Add-in layer to extend for new applications.

Add-in layer: This layer provides flexibility to make the MediaSense platform meet specific application requirements. Thus the add-in layer manages different extensible and pluggable add-ins, which can be loaded and unloaded in runtime when needed. The add-in layer can include two types of functionality: optimization components and extension components. The optimization components offer ways of optimizing the behavior and functionality of the system, and the extension components enable the extended functionality that some applications might require.

Dissemination Layer: This package is responsible for the communication between entities, circulating information between entities and discovering entities. This layer helps to share sensor data over a peer-to-peer network. It resolves a Universal Context Identifier (UCI) and transfers to other entities.

Distribution: The distribution layer serves as a bridge between MediaSense implementation and the tomP2P overlay. This is where the UCI from MediaSense and peer from tomP2P are mapped. The MediaSense ID i.e. message, UCI is paired with a peer and communicates on the overlay by using tomP2P. This package is responsible for distributing UCI on the overlay and identification as UCI-peer instead of UCI-IP address.

Util: This package contains some utility classes such as returning exception if registration or lookup fails. It contains a class to generate a unique MediaSense ID and a class to serialize to and from JSON format to enable cross-platform communication.

Messages: This particular package is dedicated to messaging between MediaSense hosts.
Read more about MediaSense.

Article written by Petra Dalunde